标签: javascript object socket.io
我的问题很简单。我有一个对象found,其中包含以下内容:{id: //socket id here, chatname: //chatname here}。我想在socket.io found.id事件中使用io.to的输出。
found
{id: //socket id here, chatname: //chatname here}
found.id
io.to
我已经确认found.id返回了一个有效的套接字ID,但是该事件没有触发。
实际事件如下:io.to(found.id).emit("dm", {...});
io.to(found.id).emit("dm", {...});
任何关于为什么会发生这种情况的想法将不胜感激。谢谢!