Problem with websokects
Hello,
I have the following code in javascript:
var support = "MozWebSocket" in window ? 'MozWebSocket' : ("WebSocket" in window ? 'WebSocket' : null);
function ConnectWebSocket() {
myWebsocket = new window[support]("wss://myserver/mychannel");
myWebsocket .onmessage = function (evt) {
alert("onmessage");
}
myWebsocket .onopen = function () {
alert("onopen");
}
myWebsocket .onclose = function () {
alert("onclose");
ConnectWebSocket();
}
}
ConnectWebSocket();
The problem is that in Firefox, the connection is opened and just after closed. Maybe the connection keep opened for a 2-3 seconds and after it is closed, and reopened again due to the call to ConnectWebSocket()
Can someone help me? In other browsers like IE or Chrome, once the connection is created, it keep opened until I leave the page. I have the 40.0.3v of Firefox
Thank you.
Other OS, Safari on Windows10 websocket error