I found a few references to this but nothing that actually direct helps. Also according to some research this is the proper way to send a message to a specific client. I have:
io.sockets.socket(players[i].id).emit('deal_card', {
// etc
});
and I get this error on that line:
Missing error handler on 'socket'.TypeError: Object #<Namespace> has no method 'socket'
Any ideas?
For socket.io 1.0 use:
io.sockets.connected[players[i].id].emit('deal_card', {..});
For 0.9 use:
io.sockets.sockets[players[i].id].emit('deal_card', {..});
(not io.sockets.socket[players[i].id].emit('deal_card', {..});)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.