Introduce a websocket ping check that closes the socket if no response.

This commit is contained in:
softsimon
2020-03-06 02:05:26 +07:00
parent b60d9cdfbc
commit 5d4ce44627
2 changed files with 31 additions and 4 deletions

View File

@@ -74,6 +74,10 @@ class WebsocketHandler {
'git-commit': this.latestGitCommitHash
}));
}
if (parsedMessage.action === 'ping') {
client.send(JSON.stringify({'pong': true}));
}
} catch (e) {
console.log(e);
}