mirror of
https://github.com/streamwall/streamwall.git
synced 2026-04-03 20:32:08 -04:00
Periodically send ping to WebSocket
This may help keep the WebSocket alive in some firewall situations.
This commit is contained in:
@@ -57,8 +57,13 @@ function initApp({
|
|||||||
|
|
||||||
ws.binaryType = 'arraybuffer'
|
ws.binaryType = 'arraybuffer'
|
||||||
|
|
||||||
|
const pingInterval = setInterval(() => {
|
||||||
|
ws.ping()
|
||||||
|
}, 20 * 1000)
|
||||||
|
|
||||||
ws.on('close', () => {
|
ws.on('close', () => {
|
||||||
sockets.delete(ws)
|
sockets.delete(ws)
|
||||||
|
clearInterval(pingInterval)
|
||||||
})
|
})
|
||||||
|
|
||||||
ws.on('message', (rawData) => {
|
ws.on('message', (rawData) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user