send user actions to admin by socket io in nodejs

Solutions on MaxInterview for send user actions to admin by socket io in nodejs by the best coders in the world

showing results for - "send user actions to admin by socket io in nodejs"
Adrián
30 Oct 2017
1socket.emit('message', "this is a test"); //sending to sender-client only
2socket.broadcast.emit('message', "this is a test"); //sending to all clients except sender
3socket.broadcast.to('game').emit('message', 'nice game'); //sending to all clients in 'game' room(channel) except sender
4socket.to('game').emit('message', 'enjoy the game'); //sending to sender client, only if they are in 'game' room(channel)
5socket.broadcast.to(socketid).emit('message', 'for your eyes only'); //sending to individual socketid
6io.emit('message', "this is a test"); //sending to all clients, include sender
7io.in('game').emit('message', 'cool game'); //sending to all clients in 'game' room(channel), include sender
8io.of('myNamespace').emit('message', 'gg'); //sending to all clients in namespace 'myNamespace', include sender
9socket.emit(); //send to all connected clients
10socket.broadcast.emit(); //send to all connected clients except the one that sent the message
11socket.on(); //event listener, can be called on client to execute on server
12io.sockets.socket(); //for emiting to specific clients
13io.sockets.emit(); //send to all connected clients (same as socket.emit)
14io.sockets.on() ; //initial connection from a client.
15