fixes: Case where websocket will not reconnect

closes #1384
This commit is contained in:
Tom Moor
2020-08-09 23:25:27 -07:00
parent 07d488c826
commit e9ce80a3aa

View File

@ -61,10 +61,16 @@ class SocketProvider extends React.Component<Props> {
});
});
this.socket.on("disconnect", () => {
this.socket.on("disconnect", (reason: string) => {
// when the socket is disconnected we need to clear all presence state as
// it's no longer reliable.
presence.clear();
if (reason === "io server disconnect") {
// the disconnection was initiated by the server, need to reconnect
// manually, else the socket will automatically try to reconnect
this.socket.connect();
}
});
this.socket.on("authenticated", () => {