Reputation: 61
I'm using Redis + Webdis on Debian 7 32.
My issue is that all websocket connections are closed with the exit code 1006 after completing the first command (except the "SUBSCRIBE" one). For example, for this testJSON() function
function testJSON() {
var jsonSocket = new WebSocket("ws://ip:7379/.json");
jsonSocket.onopen = function() {
console.log("JSON socket connected!");
jsonSocket.send(JSON.stringify(["SET", "hello", "world"]));
jsonSocket.send(JSON.stringify(["GET", "hello"]));
};
jsonSocket.onmessage = function(messageEvent) {
console.log("JSON received:", messageEvent.data);
};
jsonSocket.onclose = function(messageEvent) {
//some logging
};
jsonSocket.onerror = function(messageEvent) {
//some logging
};
}
testJSON();
i'm getting (in Firebug)
JSON socket connected!
JSON received: {"SET":[true,"OK"]}
onClose: error.code 1006
The onError event is'nt working, and after the {"SET":[true,"OK"]} response my connection closes. GET command is'nt working too. Same behavior in Firefox and Chrome. I checked the headers, it seems they are valid.
Any suggestions?
Upvotes: 3
Views: 13139
Reputation: 61
Ok, it's a feature, not bug. In code (websocket.c):
if (cmd_is_subscribe(cmd)) {
r->keep_alive = 1;
}
Changing this code solved part of my problems, but not all of them.
Upvotes: 3