> 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.1-io/initialization_examples_with_query_option.md).

# 3.1.6 初始化示例-查询选项

```javascript
const socket=io({
    query:{
        token:"code"
    }
})
```

重新连接时也可以更新查询内容：

```javascript
socket.on('reconnect_attempt',()=>{
    socket.io.opts.query={
        token:"fgh"
    }
})
```
