m7v
10/14/2016 - 4:50 AM

Saving socket ID and find it dynamicly.

Saving socket ID and find it dynamicly.

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

io.sockets.on('connection', function (socket) {
  clients[socket.id] = socket;
});
//====
var socket = clients[sId];
socket.emit('show', {});