how to create socket.io multicast groups

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-04 11:37:16

Any ideas on how to store the "file descriptors" and then individually send() data to those descriptors with socket.io?

You could store the socket.io id and use that to send messages to individual connections.

// v0.6.x
var sid = socket.sessionId;

// v0.7.x
var sid = socket.id;

You could push them onto an array on connection and remove from array on disconnection(or use redis for that).


But then again I think most times you are probably better of using namespace or rooms which you can read more information about on:

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!