Whilst polling every second works ok, it would be way better to have a reatlime feed that we could connect to.
Is it possible to have a listener built into z-way-server that would allow a Node.js (or whatever) process to open a connection and then receive realtime notifications pushed from the z-way-server process?
Realtime Socket Communication With z-way-server
-
- Posts: 18
- Joined: 29 Nov 2015 15:47
Re: Realtime Socket Communication With z-way-server
I do it the other way around; i.e. send status change events via UDP to a third party UDPListener. See Recipe section
-
- Posts: 18
- Joined: 29 Nov 2015 15:47
Re: Realtime Socket Communication With z-way-server
But do those changes get sent in realtime or is it still polling for changes internally?pz1 wrote:I do it the other way around; i.e. send status change events via UDP to a third party UDPListener. See Recipe section
Re: Realtime Socket Communication With z-way-server
I don't know how it is handled within ZWay, because that part is not opensourced. Anyhow if I do change one of my binary switches, I do see almost immediately a status change on the Android client screen that is connected to my OpenRemote controller which runs on a Synology DS212+ (Raspi sends UDP message to Synobox). Fast enough for me, and much better than the 1s polling I had defined before on the Synobox. Besides the CPU load on RasPi is considerably lower
-
- Posts: 18
- Joined: 29 Nov 2015 15:47
Re: Realtime Socket Communication With z-way-server
Hmm that seems like a really nice way to do it...
So where do you put that code? Is it in a "Load custom JavaScript code" app?
Instead of sending a UDP packet I'm going to setup a bash script to run wget to an HTTP listener localhost which will effectively send a message into a Node.js process running the HTTP listener.
Haven't thought it all through yet... might be a better way to do it
So where do you put that code? Is it in a "Load custom JavaScript code" app?
Instead of sending a UDP packet I'm going to setup a bash script to run wget to an HTTP listener localhost which will effectively send a message into a Node.js process running the HTTP listener.
Haven't thought it all through yet... might be a better way to do it
Re: Realtime Socket Communication With z-way-server
See Recipe sectioncoolbloke1324 wrote: So where do you put that code? Is it in a "Load custom JavaScript code" app?