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

what can i do in a module, porting from another mirror project

Scheduled Pinned Locked Moved Development
13 Posts 3 Posters 4.2k Views 3 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.
  • S Offline
    sdetweil
    last edited by May 18, 2018, 9:20 PM

    @idoodler

    do you have any pointers to examples of websockets from the module? or your “other JS code” means some OTHER library of JS code…

    looks like I would have to build another js class to wrap the ws services…(run the server side in the helper) cause I can’t require() in the module itself… load those classes via the scripts…

    Sam

    How to add modules

    learning how to use browser developers window for css changes

    I 1 Reply Last reply May 18, 2018, 9:29 PM Reply Quote 0
    • I Offline
      idoodler Module Developer @sdetweil
      last edited by May 18, 2018, 9:29 PM

      @sdetweil A MagicMirror Module has two parts, the node_helper.js and any other required node.js modulewhich runs on your Raspberry Pi, the other part is just plain Javascript like in any Website running on the Browser (Electron in the default case).

      There are many node.js websocket server modules: https://www.npmjs.com/search?q=Websocket

      Your node_helper.js is running the Websocket server and your other part is running a Websocket client. Follow this tutorial for the Websocket Client

      The communication won’t be encrypted in any way, so don’t pass importand information over the Websocket!

      1 Reply Last reply Reply Quote 0
      • S Offline
        sdetweil
        last edited by May 19, 2018, 12:29 PM

        thanks… not a nodejs developer generally, so didn’t know about the npmjs site…

        also, i run the MM on an ODROID not PI. a lot faster.

        i understand how ws works… i built a custom ws server and interface in front of an api emulation platform to support software testing a couple years ago.

        Sam

        How to add modules

        learning how to use browser developers window for css changes

        1 Reply Last reply Reply Quote 1
        • S Offline
          sdetweil
          last edited by May 21, 2018, 3:34 PM

          i have done some work over the weekend to get my two modules and their helpers working to do the basics…

          database access is working, rest api server is working. (scheduler helper)
          browser window creation and destruction is working, and image loading (handler helper)

          one thing of note, a json object transports from module to helper and back. BUT any data added to the object in the helper (like a browserwindow object), does NOT transport (becomes undefined on receipt.)

          Sam

          How to add modules

          learning how to use browser developers window for css changes

          I 1 Reply Last reply May 21, 2018, 3:46 PM Reply Quote 0
          • I Offline
            idoodler Module Developer @sdetweil
            last edited by May 21, 2018, 3:46 PM

            @sdetweil The module helper communication relies on a websocket connection. Any references will be lost. Try to clone the Object.

            S 1 Reply Last reply May 29, 2018, 1:40 PM Reply Quote 0
            • S Offline
              sdetweil @idoodler
              last edited by May 29, 2018, 1:40 PM

              @idoodler thanks… i changed where the data is used and moved the routines to the node_helper… all good…

              Sam

              How to add modules

              learning how to use browser developers window for css changes

              I 1 Reply Last reply May 29, 2018, 3:28 PM Reply Quote 0
              • I Offline
                idoodler Module Developer @sdetweil
                last edited by May 29, 2018, 3:28 PM

                @sdetweil Glad I could help you!

                1 Reply Last reply Reply Quote 0
                • 1
                • 2
                • 2 / 2
                • First post
                  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