reconnecting-websocket icon indicating copy to clipboard operation
reconnecting-websocket copied to clipboard

Fix: handle error if getNextUrl throws

Open jamfromouterspace opened this issue 3 years ago • 1 comments

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.

jamfromouterspace avatar Sep 18 '21 15:09 jamfromouterspace

Wow it's really bad - we have a multiple retries to reconnect but still cannot connect due to this failure

Lonli-Lokli avatar Feb 23 '24 18:02 Lonli-Lokli