From afb952d854e1d8728ce07b7c3a9f0dee2a61ef4e Mon Sep 17 00:00:00 2001 From: Damien Arrachequesne Date: Thu, 29 Mar 2018 23:15:22 +0200 Subject: [PATCH] [docs] Add a note about reconnecting after a server-side disconnection --- docs/API.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/docs/API.md b/docs/API.md index 5ebbcbce7..69cba5ae8 100644 --- a/docs/API.md +++ b/docs/API.md @@ -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 }); ```