socket timeout set to 5 seconds

parent 360185ed
Showing with 8 additions and 7 deletions
......@@ -19,7 +19,7 @@ module.exports = function roomsHook (sails) {
* pdb_count (number of connections to the given room from Pictogram Web)
* pcb_count (number of connections to the given room from Pictogram Communicator/Supervisor)
*/
getUICount: function (room) {
getUICount: function (room, cb) {
// Let's count number of connections per room and per UI
var counter = {'PCB': 0, 'PDB': 0};
//console.log('notifyRoom (' + room + ')---->\n' + JSON.stringify(sockets) + '\n' + JSON.stringify(rooms));
......@@ -34,7 +34,7 @@ module.exports = function roomsHook (sails) {
if (err)
sails.debug.log("Error when notifying room " + JSON.stringify(err));
else
return ({
cb({
'room': room,
'pdb_count': counter['PDB'],
'pcb_count': counter['PCB']
......@@ -49,10 +49,12 @@ module.exports = function roomsHook (sails) {
*/
notifyRoom: function(room) {
// Broadcast data to room's peers
sails.hooks.events.broadcastEvent(
room,
sails.hooks.events.roomSubscribersChange(sails.hooks.events.getUICount(room));
);
sails.hooks.events.getUICount(room, (info) => {
sails.hooks.events.broadcastEvent(
room,
sails.hooks.events.roomSubscribersChange(info)
);
});
},
/**************************************************************************
......@@ -189,6 +191,5 @@ module.exports = function roomsHook (sails) {
sails.hooks.rooms.unsubscribeFromRoom(sockets[socket.id].sup_room, socket);
}
}
};
};
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment