socket.io client to client messaging

前端 未结 3 830
花落未央
花落未央 2021-01-15 08:22

I\'m having trouble getting basic client to client (or really client->server->client) working with socket.io. Heres the code I have right now:

io.sockets.on(         


        
3条回答
  •  别那么骄傲
    2021-01-15 08:57

    Try

    users.push(socket); // without .sessionId
    
    for (var u in users)    {
       // users[u] is now the socket
       console.log(users[u].id);
       users[u].emit('message', { msg: 'New User Connected succesfully' });
    }
    

提交回复
热议问题