> For the complete documentation index, see [llms.txt](https://socket.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://socket.gitbook.io/docs/3-ke-hu-duan-apiclientapi/3.3-socket/socket_id.md).

# 3.3.1 socket.id

* (String)

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

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

console.log(socket.id) //undefined

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