Skip to content

Conversation

caylazabel
Copy link

No description provided.

ee.emit('default', client, data.toString());
});


Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To answer your question, yes, you want to use the socket.destroy(error) method. Try emitting an event when a command ('@whatever') to use in your chat server. You'll need to pass in a 'client' argument. Once the event is hit, you want to destroy the socket property of that client along with an error message. Hope that helps!




socket.on('close', function(){
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

socket.on('close', function(client){ <---- you want to pass in a client so the command can close a specific client.

pool.forEach(c => {
let index = indexOf(c);
if(c.id === client.id){
pool.splice(index, 1);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pool.splice(pool.indexOf(client), 1); <---- this will look for the client's index in the array and remove the client alone.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants