Skip to content

Commit

Permalink
[docs] Add a note about reconnecting after a server-side disconnection
Browse files Browse the repository at this point in the history
  • Loading branch information
darrachequesne committed Mar 29, 2018
1 parent 74893d5 commit afb952d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion docs/API.md
Expand Up @@ -603,7 +603,11 @@ Fired upon a disconnection.

```js
socket.on('disconnect', (reason) => {
// ...
if (reason === 'io server disconnect') {
// the disconnection was initiated by the server, you need to reconnect manually
socket.connect();
}
// else the socket will automatically try to reconnect
});
```

Expand Down

2 comments on commit afb952d

@yanxiaoyan2020
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@darrachequesne
I tested flask-socketIO
When I select and refreshing browser(socketio client),The web server first receives 'disconnect' before receiving 'connect' event . I don't know why. Does the server receives firstly 'disconnet' then receiving 'connect' event?

@yanxiaoyan2020
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have alread my question. Thank you.

Please sign in to comment.