Skip to content

Commit d0fe2cd

Browse files
committed
fix: autoconnect chat on more error types
1 parent ec7ba91 commit d0fe2cd

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/hooks/chat.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ const historyIds = new Set();
1313

1414
function handleClose(event) {
1515
console.debug('Disconnected', event);
16-
if (event.code !== 1000) return;
16+
if (![1000, 1006].includes(event.code)) return;
1717
setTimeout(reconnect, 1000 * reconnectAttempts);
1818
}
1919

@@ -52,7 +52,7 @@ function bind(socketChat) {
5252
};
5353
}
5454

55-
function reconnect() {
55+
export default function reconnect() {
5656
if (!isActive() || guestMode.isSet() || reconnectAttempts > 3 || global('socketChat', { throws: false })?.readyState !== WebSocket.CLOSED) return;
5757
reconnectAttempts += 1;
5858
const socket = new WebSocket(`wss://${location.hostname}/chat`);

0 commit comments

Comments
 (0)