Skip to content

Commit afb952d

Browse files
[docs] Add a note about reconnecting after a server-side disconnection
1 parent 74893d5 commit afb952d

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

docs/API.md

+5-1
Original file line numberDiff line numberDiff line change
@@ -603,7 +603,11 @@ Fired upon a disconnection.
603603

604604
```js
605605
socket.on('disconnect', (reason) => {
606-
// ...
606+
if (reason === 'io server disconnect') {
607+
// the disconnection was initiated by the server, you need to reconnect manually
608+
socket.connect();
609+
}
610+
// else the socket will automatically try to reconnect
607611
});
608612
```
609613

0 commit comments

Comments
 (0)