A way to push data to client side ?

Discussions about RaZberry - Z-Wave board for Raspberry computer
Post Reply
edafonseca
Posts: 13
Joined: 12 May 2014 22:48

A way to push data to client side ?

Post by edafonseca »

Hello,
I'm looking to a way to push devices metrics changes directly to client side, instead of polling information every x seconds.
I know node.js with socket.io can do that for example.
Can I integrate socket.io directly in a home automation module, adding it to node.js dependencies ? How ?

If someone has done that yet, I would be happy to know the best way.

Thanks
User avatar
PoltoS
Posts: 7624
Joined: 26 Jan 2011 19:36

Re: A way to push data to client side ?

Post by PoltoS »

Z-Way has http.request() to push data using HTTP requests. No socket.io available
edafonseca
Posts: 13
Joined: 12 May 2014 22:48

Re: A way to push data to client side ?

Post by edafonseca »

Thanks for your reply. Http.request can push data to a webserver, but no to à browser.
Should I make à node.js webserver on the raspberry on which I push data from z-way with http.request and then use socket.io on it to push data to à web browser ? Is that à good way ? Is there another solution ?

So I have to make à module on home automation for that ? Listening events and sending to my webserver ?

Thanks
User avatar
PoltoS
Posts: 7624
Joined: 26 Jan 2011 19:36

Re: A way to push data to client side ?

Post by PoltoS »

We hope to implment websockets in a few months.
pz1
Posts: 2053
Joined: 08 Apr 2012 13:44

Re: A way to push data to client side ?

Post by pz1 »

We hope to implment websockets in a few months
Would be great! I have been pondering for quite a while to push status updates to the UDP listener of OpenRemote instead of frequent polling on that end.
Since 29-12-2016 I am no longer a moderator for this forum
edafonseca
Posts: 13
Joined: 12 May 2014 22:48

Re: A way to push data to client side ?

Post by edafonseca »

We hope to implment websockets in a few months
In fact, that would be awesome:) You're doing a really good job, specially the last development version.

I will make a node.js application with a rest api, called by an home automation module (with http.request) who is listening metric events, and push data with socket.io, from node.js to my client interface.

Thank you for your answer.
User avatar
alexey.zimarev
Posts: 24
Joined: 16 Oct 2012 17:54

Re: A way to push data to client side ?

Post by alexey.zimarev »

It is not that complex to do it now. You can install something like an Apache httpd and PHP on your RPi and add socket.io page, setup http reverse proxy via Apache (good thing to do anyway) and add some pages to handle POST request that you can make from Z-Way virtual device. And your PHP page will push updates to the browser.

But in general the best solution IMHO would be to make Z-Way a Node.js module.
Post Reply