Skip to content
This repository was archived by the owner on Mar 23, 2023. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions kurento-one2many-call/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,13 @@ function nextUniqueId() {
*/
wss.on('connection', function(ws) {

// prevent 1006 close on client
var heartbeat = setInterval(function(){
// https://github.com/websockets/ws/blob/master/doc/ws.md#websocketpingdata-mask-callback
ws.ping();
}, 3000);


var sessionId = nextUniqueId();
console.log('Connection received with sessionId ' + sessionId);

Expand All @@ -85,6 +92,7 @@ wss.on('connection', function(ws) {
ws.on('close', function() {
console.log('Connection ' + sessionId + ' closed');
stop(sessionId);
clearInterval(heartbeat);
});

ws.on('message', function(_message) {
Expand Down