Open joergs-git opened 7 years ago
@PoltoS : I just got a little step further: If I remove the protocol parameter suddenly it seems to work and connection stays alive. Bad implementation of websocket details?
The following basically doesn't work, unless I remove the "toptron-protocol":
var sock = new sockets.websocket("ws://192.168.1.61:23456","toptron-protocol"); sock.onopen = function () {sock.send("set:LIGHT_OUT1=%%"); setTimeout('sock.close();',1000); };
(I don't know if I really need to manually close the socket, but this doesn't seem to be the problem in the moment. )
What I also found strange is, that (if I remove the protocol paramter) I am not really able to send subsequent websocket-messages without having wait for a disconnect first.
e.g.
var sock = new sockets.websocket("ws://192.168.1.61:23456");} sock.send("set:LIGHT_OUT1=%%");
Results in a websocket-debugging-log like this:
> user@raspberrypi3-jkl1:~# wscat -l 23456 -p toptron-protocol
listening on port 23456 (press CTRL+C to quit)
client connected
< set:LIGHT_OUT1=0
disconnected
client connected
< set:LIGHT_OUT1=99
disconnected
client connected
< set:LIGHT_OUT1=0
disconnected
client connected
< set:LIGHT_OUT1=1
disconnected
client connected
disconnected
see also detailed steps to reproduce this problem here: http://forum.z-wave.me/viewtopic.php?f=3419&t=22347&start=30#p69949
@PoltoS, I installed the debian package version 2.3.8-rc8 on stretch but the issue still exists.
You may be aware of this since this issue is still open. However, according to the following release notes it should work: "- Added libraries for Raspbian Stretch" "- Fixed socket not being closed on peer disconnect"
Hi, I am trying to use a code-device to access a external websocket server. So entered one simple line of code as follows:
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=%%"); };
Basically a connection from the UI to the external websocket server is being successfully established, but it's immediately closed again, before able so send actual commands. Maybe because of a missing ping? However my actual ws.send command or ws.send ping command is not even getting through, because the connection has already closed down again.
Is there a way to set a timeout or generate a ping in different ways to make this work?