socket.id

  • (String)

socket会话的唯一标识符。在触发connect事件后设置,并在reconnect事件后更新。

const socket= io('http://localhost');

console.log(socket.id) //undefined

socket.on('connect',()=>{
    console.log(socket.id) // xxxx...
})

results matching ""

    No results matching ""