Sending message to specific client with socket.io and empty message queue

to send a message to a specific client save every one that connects to the server in an Object.

var socketio = require('socket.io');
var clients = {};
var io = socketio.listen(app);

io.sockets.on('connection', function (socket) {
  clients[socket.id] = socket;
});

then you can later do something like this:

var socket = clients[sId];
socket.emit('show', {});

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)