我试图在连接上向我的套接字对象添加一些自定义信息,这样当我断开套接字时,我可以读取该自定义信息.
IE:
// (Client)
socket.on('connect', function(data){
socket.customInfo = 'customdata';
});
// (server)
socket.on('disconnect', function () {
console.log(socket.customInfo);
});
Run Code Online (Sandbox Code Playgroud)