Communication between webserver and MM
-
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!
-
@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
-
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.Thanks again!
-
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
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
-
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. -
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!
-
@bartalluyn thats what i meant in first place
-
@strawberry-3.141
Indeed, that’s what I realized after browsing through the syslog code. Kudo’s!