Fixed #9
parent
6a94c5de94
commit
254762eb8a
|
@ -78,6 +78,9 @@ exports.handleDisconnect = function(client)
|
||||||
//save the padname of this session
|
//save the padname of this session
|
||||||
var sessionPad=session2pad[client.sessionId];
|
var sessionPad=session2pad[client.sessionId];
|
||||||
|
|
||||||
|
//if this connection was already etablished with a handshake, send a disconnect message to the others
|
||||||
|
if(sessioninfos[client.sessionId].author)
|
||||||
|
{
|
||||||
var author = sessioninfos[client.sessionId].author;
|
var author = sessioninfos[client.sessionId].author;
|
||||||
|
|
||||||
//get the author color out of the db
|
//get the author color out of the db
|
||||||
|
@ -99,6 +102,14 @@ exports.handleDisconnect = function(client)
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//Go trough all user that are still on the pad, and send them the USER_LEAVE message
|
||||||
|
for(i in pad2sessions[sessionPad])
|
||||||
|
{
|
||||||
|
socketio.clients[pad2sessions[sessionPad][i]].send(messageToTheOtherUsers);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
//Go trough all sessions of this pad, search and destroy the entry of this client
|
//Go trough all sessions of this pad, search and destroy the entry of this client
|
||||||
for(i in pad2sessions[sessionPad])
|
for(i in pad2sessions[sessionPad])
|
||||||
{
|
{
|
||||||
|
@ -109,16 +120,9 @@ exports.handleDisconnect = function(client)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Go trough all user that are still on the pad, and send them the USER_LEAVE message
|
|
||||||
for(i in pad2sessions[sessionPad])
|
|
||||||
{
|
|
||||||
socketio.clients[pad2sessions[sessionPad][i]].send(messageToTheOtherUsers);
|
|
||||||
}
|
|
||||||
|
|
||||||
//Delete the session2pad and sessioninfos entrys of this session
|
//Delete the session2pad and sessioninfos entrys of this session
|
||||||
delete session2pad[client.sessionId];
|
delete session2pad[client.sessionId];
|
||||||
delete sessioninfos[client.sessionId];
|
delete sessioninfos[client.sessionId];
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue