Read the statement by Michael Teeuw here.
How to receive push notifications from another server?
-
The MagicMirror contains a SocketIO server. You could connect to that server and push notifications on the module specific channel. It’s an undocumented feature, so you might need to digg into the code.
-
Thanks for the really quick answer! :-)
Do you have any hint in which files I could start digging? -
I did some experiments but no success yet. Maybe you could clarify some things:
- What do you mean by ‘module specific channel’? How does that work?
- I tried to emit an event via a java application, but I don’t know which parameters to use so that the event is passed to my module?
- Where is the code that processes incoming socket events?
I tried socket.io-java-client, but nothing happens on the server (log remains empty, module does not return anything):
public static void main(String[] args) throws Exception { Socket socket = IO.socket("http://raspi:8080"); // I also tried: http://raspi:8080/socket-test-module socket.connect(); socket.emit("notification", "ping"); socket.close(); }
Any ideas how to get a simple external socket client running?
-
@paphko said in How to receive push notifications from another server?:
On the openhab side, I can easily add some arbitrary java code, for example to perform some http requests or to open and communicate via a socket connection to a specific IP.
in a module i forked from paviro, there is a functionality where you can make http requests to the module https://github.com/fewieden/MMM-syslog/blob/master/node_helper.js#L16
-
@strawberry-3.141 Awesome, thank you! That’s exactly what I was looking for :-)