• Recent
  • Tags
  • Unsolved
  • Solved
  • MagicMirror² Repository
  • Documentation
  • 3rd-Party-Modules
  • Donate
  • Discord
  • Register
  • Login
MagicMirror Forum
  • Recent
  • Tags
  • Unsolved
  • Solved
  • MagicMirror² Repository
  • Documentation
  • 3rd-Party-Modules
  • Donate
  • Discord
  • Register
  • Login
A New Chapter for MagicMirror: The Community Takes the Lead
Read the statement by Michael Teeuw here.

client/server architecture

Scheduled Pinned Locked Moved General Discussion
4 Posts 2 Posters 975 Views 2 Watching
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    peterbarlow2000
    last edited by Jan 26, 2020, 5:02 PM

    I’m running a server-only-MM on my server and the client MM on a raspberry pi. So far so good.
    I want to write a module to monitor the status of the clients WIFI connection and display it. Hmmm, so where does the code get executed. It seems that the default architecture would have the code executed on the server. I’m struggling to understand the fundamental architecture of the MM system. The code needs to be execute on the client (by electron?). Any ideas?

    S 1 Reply Last reply Jan 26, 2020, 5:33 PM Reply Quote 1
    • S Away
      sdetweil @peterbarlow2000
      last edited by sdetweil Jan 26, 2020, 5:35 PM Jan 26, 2020, 5:33 PM

      @peterbarlow2000 the node_helper file gets executed on the server, (one instance for all clients)
      and the file in the module folder that matches the module name (modulename.js we call it)
      runs on the client (one instance for each client)

      I would change this

      code needs to be executed on the client (by electron?).
      

      to

      code needs to be executed on the client (in the browser?).
      

      Sam

      How to add modules

      learning how to use browser developers window for css changes

      1 Reply Last reply Reply Quote 2
      • S Away
        sdetweil
        last edited by Jan 26, 2020, 5:50 PM

        u can look at an example of how to connect the two to insure correct connection,

        see my two posts starting here
        https://forum.magicmirror.builders/topic/12021/making-my-first-module-issue-with-notifications/7

        modulename.js creates a random number on startup (per client)
        and that is appended to the module identifier (per module: in config.js on server)
        to create a unique module/client pair, and that is passed in/out on any requests to/responses from the node_helper

        Sam

        How to add modules

        learning how to use browser developers window for css changes

        1 Reply Last reply Reply Quote 2
        • S Away
          sdetweil
          last edited by sdetweil Jan 28, 2020, 3:45 PM Jan 28, 2020, 2:25 AM

          oh, and the sendSocketNotification from the node_helper back to the modulename.js sends to ALL clients at once… so the client must check if the message is intended for them by checking the identifier supplied by the node_helper

          Sam

          How to add modules

          learning how to use browser developers window for css changes

          1 Reply Last reply Reply Quote 0
          • 1 / 1
          1 / 1
          • First post
            1/4
            Last post
          Enjoying MagicMirror? Please consider a donation!
          MagicMirror created by Michael Teeuw.
          Forum managed by Sam, technical setup by Karsten.
          This forum is using NodeBB as its core | Contributors
          Contact | Privacy Policy