Skip to content

Commit b83ba90

Browse files
committed
feat: allow forcing a reconnect
1 parent 151b39a commit b83ba90

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
@@ -52,8 +52,8 @@ function bind(socketChat) {
5252
};
5353
}
5454

55-
export default function reconnect() {
56-
if (!isActive() || guestMode.isSet() || reconnectAttempts > 3 || global('socketChat', { throws: false })?.readyState !== WebSocket.CLOSED) return;
55+
export default function reconnect(force = false) {
56+
if (!force && (!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`);
5959
globalSet('socketChat', socket);

0 commit comments

Comments
 (0)