MagicMirror Forum

    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unsolved
    • Solved
    • MagicMirror² Repository
    • Documentation
    • Donate
    • Discord

    client/server architecture

    General Discussion
    2
    4
    446
    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
      peterbarlow2000 last edited by

      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 Reply Quote 1
      • S
        sdetweil @peterbarlow2000 last edited by sdetweil

        @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

        Create a working config
        How to add modules

        1 Reply Last reply Reply Quote 2
        • S
          sdetweil last edited by

          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

          Create a working config
          How to add modules

          1 Reply Last reply Reply Quote 2
          • S
            sdetweil last edited by sdetweil

            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

            Create a working config
            How to add modules

            1 Reply Last reply Reply Quote 0
            • 1 / 1
            • First post
              Last post
            Enjoying MagicMirror? Please consider a donation!
            MagicMirror created by Michael Teeuw.
            Forum managed by Paul-Vincent Roll and Rodrigo Ramírez Norambuena.
            This forum is using NodeBB as its core | Contributors
            Contact | Privacy Policy