reconnecting-websocket
reconnecting-websocket copied to clipboard
Fix: handle error if getNextUrl throws
Problem
If getNextUrl throws an error, the websocket will never be able to reconnect again. For example:
async () => {
const token = await getToken()
return baseUrl + token
},
This is because _connect()
has no catch
to reset _connectLock
.
Fix
This simply adds a catch to reset _connectLock
and handle the error like any other.
Wow it's really bad - we have a multiple retries to reconnect but still cannot connect due to this failure