我试图发出一个特定的套接字ID:
socket(user[playID]).emit('correct', data);
Run Code Online (Sandbox Code Playgroud)
但是我得到了:
TypeError: object is not a function
Run Code Online (Sandbox Code Playgroud)
如果我退出,user[playID]我会得到一个有效的套接字ID.
不胜感激!
这是我的设置,以防我错过了什么:
// Tell Socket.io to pay attention
servio = io.listen(server);
// Tell HTTP Server to begin listening for connections on port 3250
sock = server.listen(3250);
Run Code Online (Sandbox Code Playgroud)