Skip to content

Commit

Permalink
UPD: Send ping periodically
Browse files Browse the repository at this point in the history
  • Loading branch information
paulov-t committed Sep 8, 2022
1 parent a1d3229 commit 0a2f218
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions bin/www.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 0a2f218

Please sign in to comment.