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

Communication between webserver and MM

Scheduled Pinned Locked Moved Troubleshooting
8 Posts 3 Posters 3.6k 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.
  • B Offline
    bartalluyn
    last edited by Jan 20, 2017, 10:34 PM

    Hi, I want to create a communication between the server.js and the main.js . I send a http get request to the server, and it needs to send a message to the MM to, for instance, hide a module.

    I’ve tried with IPC (ipcMain, ipcRenderer), but every time there seems to be something wrong. Undefined variables or non-existing methods.

    Can some one assist?

    thanks!

    S 1 Reply Last reply Jan 21, 2017, 12:44 PM Reply Quote 0
    • S Offline
      strawberry 3.141 Project Sponsor Module Developer @bartalluyn
      last edited by Jan 21, 2017, 12:44 PM

      @bartalluyn you can extend the server in a module and there you also can perform tasks like hide other modules, there is no need to change the core for it

      Please create a github issue if you need help, so I can keep track

      1 Reply Last reply Reply Quote 0
      • B Offline
        bartalluyn
        last edited by Jan 21, 2017, 4:50 PM

        Re: Communication between webserver and MM

        Hi strawberry,
        many thanks for your reply.

        I’ve been playing around. A lot. And I’ve come to a solution.
        The reason why I want to adjust the core is because I want to be able to control the entire mirror from another application. Whether it be a desktop application, another background process, and even Alexa Voice Services. The easiest way to do this is via HTTP I think, certainly because those processes could be running on other machines. I’ve succeeded in creating a system to do this. You can read all about in on my blog.

        [https://smartmirrorprojectblog.wordpress.com/2017/01/21/letting-the-electron-server-speak-to-the-mirror-client/](link url)

        Thanks again!

        1 Reply Last reply Reply Quote 0
        • B Offline
          broberg Project Sponsor
          last edited by broberg Jan 21, 2017, 5:21 PM Jan 21, 2017, 5:20 PM

          I’m no where near a coder so disregard this If I don’t get it, but after some fast reading of your blog post, it sounds like you should be able to use the code from [card:paviro/MMM-syslog]

          to take commands from HTTP, the syslog module takes information from a string like this : http://MIRROR_IP:MIRROR_PORT/syslog?type=INFO&message=YOUR_MESSAGE

          1 Reply Last reply Reply Quote 1
          • B Offline
            bartalluyn
            last edited by Jan 22, 2017, 9:05 AM

            @broberg

            thank you very much for pointing this out to me. Looking at the code that might indeed be a viable alternative.
            I’m going to check it out, and post an article to my blog with my findings.

            1 Reply Last reply Reply Quote 0
            • B Offline
              bartalluyn
              last edited by Jan 22, 2017, 12:10 PM

              Hi there,
              I’ve been playing around, and changed the solution to the MMM-syslog alternative.
              Check it out in my blogpost:
              [https://smartmirrorprojectblog.wordpress.com/2017/01/22/an-alternative-custom-module/](link url)

              Thanks again for the pointer!

              S 1 Reply Last reply Jan 22, 2017, 12:17 PM Reply Quote 1
              • S Offline
                strawberry 3.141 Project Sponsor Module Developer @bartalluyn
                last edited by Jan 22, 2017, 12:17 PM

                @bartalluyn thats what i meant in first place

                Please create a github issue if you need help, so I can keep track

                B 1 Reply Last reply Jan 22, 2017, 12:34 PM Reply Quote 0
                • B Offline
                  bartalluyn @strawberry 3.141
                  last edited by Jan 22, 2017, 12:34 PM

                  @strawberry-3.141
                  Indeed, that’s what I realized after browsing through the syslog code. Kudo’s!

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