> 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/4-fu-wu-duan-apiserverapi/4.3-socket/socket_rooms.md).

# 4.3.2 socket\_rooms

* (Object)

标识此socket所在房间的字符串哈希，按房间名称索引。

```javascript
io.on('connection',(socket)=>{
    socket.join('room 237',()=>{
        let rooms= Object.keys(socket.rooms)
        console.log(rooms); // [ <socket.id>,"room 237" ]
    })
})
```
