1
Fork 0
mirror of https://github.com/Steffo99/todocolors.git synced 2024-11-25 17:54:18 +00:00

Fix useWs not reconnecting after an error

This commit is contained in:
Steffo 2023-08-19 05:23:04 +02:00
parent e8d16b34ca
commit 9c6b9f9b3d
Signed by: steffo
GPG key ID: 2A24051445686895

View file

@ -84,7 +84,7 @@ export function useWs(url: string | undefined, {onclose, onerror, onmessage, ono
} }
sock.onclose = (event) => { sock.onclose = (event) => {
console.debug("[useWebSocket] Closed connection:", event) console.debug("[useWebSocket] Closed connection:", event)
dispatch({event: "stateChange"}) dispatch({event: "disconnect"});
onclose?.({event, closeWebSocket}); onclose?.({event, closeWebSocket});
} }
sock.onerror = (event) => { sock.onerror = (event) => {