Skip to content
Snippets Groups Projects
Commit 0006034f authored by Anton's avatar Anton
Browse files

trying to fix web socket disconnect

parent cd270ef7
No related branches found
No related tags found
No related merge requests found
......@@ -494,10 +494,16 @@ function connectWebSocket() {
ws.send(JSON.stringify(userData));
console.log("Web socket opened");
setInterval(function () {
let clock = setInterval(function () {
console.log("Ping server");
ws.send("ping");
}, 1000);
}, 10000);
ws.onclose = function () {
console.log("Web socket closed");
clearInterval(clock)
};
};
ws.onmessage = function (res) {
......@@ -518,8 +524,8 @@ function connectWebSocket() {
ws.onclose = function () {
console.log("Web socket closed");
};
ws.onerror = function () {
console.log("Web socket error");
ws.onerror = function (e) {
console.log("Web socket error", e);
};
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment