MagicMirror² v2.13.0 is available! For more information about this release, check out this topic.

client/server architecture



  • 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?



  • @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?).
    


  • 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



  • 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


Log in to reply