> 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_connected.md).

# 3.3.2 socket.connected

* (Boolean)

socket是否连接到服务器。

```javascript
const socket= io('http://localhost');
socket.on('connect',()=>{
    console.log(socket.connected) //true
})
```
