From 0a2f21879fc581bdc083aec4082ab7d78148a2dd Mon Sep 17 00:00:00 2001 From: Paulov Date: Thu, 8 Sep 2022 07:53:05 +0100 Subject: [PATCH] UPD: Send ping periodically --- bin/www.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/bin/www.js b/bin/www.js index c60c3ca..8a064ff 100644 --- a/bin/www.js +++ b/bin/www.js @@ -120,10 +120,11 @@ wss.on('connection', (ws, request) => { // Notify of Client connected logger.logSuccess('WebSocket Client connected ' + ws.ChannelId); // Send "ping" type back to the Client to make it happy - ws.send(JSON.stringify({ type: "ping", eventId: ws.ChannelId })); - // setInterval(()=>{ - // ws.send(JSON.stringify({ type: "ping", eventId: ws.ChannelId })); - // }, 1000); + // ws.send(JSON.stringify({ type: "ping", eventId: ws.ChannelId })); + setInterval(()=>{ + + ws.send(JSON.stringify({ type: "ping", eventId: ws.ChannelId })); + }, 15000); wss.LastChannelId = wss.NextChannelId; // Respond to messages ws.on('message', function message(data) {