websocket client

Discussions about Z-Way software and Z-Wave technology in general
injecteer
Posts: 13
Joined: 29 Sep 2016 16:28

Re: websocket client

Post by injecteer »

Then how can I call it and how can it work like charm?

Code: Select all

this.ws = new sockets.websocket( wsUrl );
this.ws.send( s );
:o :shock:

Update:
`ws.push()` is undefined as of 2.2.2
injecteer
Posts: 13
Joined: 29 Sep 2016 16:28

Re: websocket client

Post by injecteer »

I just discovered, that the

Code: Select all

  new sockets.websocket( self.wsUrl );
sends no ping's. That leads to the connection termination by Nginx after a timeout.

Is there any way to send WS-pings out of the box?
User avatar
PoltoS
Posts: 7565
Joined: 26 Jan 2011 19:36

Re: websocket client

Post by PoltoS »

Just add a setTimeout with a ping ;)
injecteer
Posts: 13
Joined: 29 Sep 2016 16:28

Re: websocket client

Post by injecteer »

rgr, thats what I thought ;)
klaasjoerg
Posts: 126
Joined: 30 Sep 2016 23:49

Re: websocket client

Post by klaasjoerg »

Hi. Did you finally found a solution?
I have the same issue and can't see it solved. My websocket-zwave-client is initiating a connection to a websocket server but closing down immediately again. My code devices looks like this right now (including a ping and settimeout) but no effect....
Any ideas?

Code: Select all

var ws = new sockets.websocket("ws://192.168.1.61:23456/","toptron-protocol"); ws.onopen = function() { ws.send (" ping "); setTimeout(10000);  ws.send("set:LIGHT_OUT1=%%"); };
The websocket-server-debug-result is just:

Code: Select all

client connected
disconnected
klaasjoerg
Posts: 126
Joined: 30 Sep 2016 23:49

Re: websocket client

Post by klaasjoerg »

Meanwhile I found, that I get a step further, if I remove the whole "protocol" definition. (Of course this is not my solution, but at least I get a properly connect and ping etc.)

Ideas?
User avatar
PoltoS
Posts: 7565
Joined: 26 Jan 2011 19:36

Re: websocket client

Post by PoltoS »

Not sure how this protocol thing work in WS. Do you need to specify it?
klaasjoerg
Posts: 126
Joined: 30 Sep 2016 23:49

Re: websocket client

Post by klaasjoerg »

Unfortunately yes, because the websocket server is ignoring requests without protocol definition.
(In this case it's a Knaus camper that allows dimming lights etc. via websocket connection. Actually a cool thing putting zwave into a camper and do all the nice stuff).

Right now I am kind of stuck here, because without this, the project is in a dead end...
User avatar
PoltoS
Posts: 7565
Joined: 26 Jan 2011 19:36

Re: websocket client

Post by PoltoS »

Can you send us in PM or by mail a sniplet of code to test it (if possible with access to that server) and a demo with correctly working handshake form a browser WS? We will then check our code
klaasjoerg
Posts: 126
Joined: 30 Sep 2016 23:49

Re: websocket client

Post by klaasjoerg »

Direct access is probably difficult, because it's a camper. I'll try to copy the websocket server (raspberry based) and make some tests tomorrow. Will keep you informed.
Post Reply