Closed Mattyzero closed 9 years ago
Hi, you can close the client socket, this will disconnect him immediately.
the way you do it depend on how you want to handle the disconnection. here are two places where you can grab the client socket and close it
when a client connects you have access to the client socket from onConnect event (
eurecaServer.on('connect', function (socket) {
//you can close the client socket or store it to close it later
socket.close(); //<-- this will disconnect the client who just connected
});
// eurecaServer.onConnect() syntax work aswell but it's preferable to use the above one.
when a client call the server you have access to the socket from context
eurecaServer.exports.disconnectMe = function () {
console.log("disconnecting caller client ");
this.socket.close(); //<-- this will disconnect the client who called this function remotely
}
I want to disconnect from the client when I notice that he is already in the lobby but in a new window. (per Lobby only one user)
Is there any solution to fix that?
best regards Matthias