feat(utilities): FOSS-WS send SESSION_RECONNECTED on session's reconnection

This commit is contained in:
Taha Yassine Kraiem 2022-04-06 15:28:22 +02:00
parent 011cbd006b
commit c30ceb447d

View file

@ -12,6 +12,7 @@ const AGENT_DISCONNECT = "AGENT_DISCONNECTED";
const AGENTS_CONNECTED = "AGENTS_CONNECTED";
const NO_SESSIONS = "SESSION_DISCONNECTED";
const SESSION_ALREADY_CONNECTED = "SESSION_ALREADY_CONNECTED";
const SESSION_RECONNECTED = "SESSION_RECONNECTED"
let io;
const debug = process.env.debug === "1" || false;
@ -258,6 +259,7 @@ module.exports = {
debug && console.log(`notifying new session about agent-existence`);
let agents_ids = await get_all_agents_ids(io, socket);
io.to(socket.id).emit(AGENTS_CONNECTED, agents_ids);
socket.to(socket.peerId).emit(SESSION_RECONNECTED, socket.id);
}
} else if (c_sessions <= 0) {