webSocketServer node.js how to differentiate clients

后端 未结 10 2045
[愿得一人]
[愿得一人] 2020-12-22 19:36

I am trying to use sockets with node.js, I succeded but I don\'t know how to differentiate clients in my code. The part concerning sockets is this:

var WebSo         


        
10条回答
  •  死守一世寂寞
    2020-12-22 20:28

    You can check the connection object. It has built-in identification for every connected client; you can find it here:

    let id=ws._ultron.id;
    console.log(id);
    

提交回复
热议问题