Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: handle error if getNextUrl throws #166

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jamfromouterspace
Copy link

@jamfromouterspace jamfromouterspace commented Sep 18, 2021

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.

threepointone added a commit to partykit/partykit that referenced this pull request Jan 8, 2023
This forks `reconnecting-websocket` into our own package, and adds some functionality from abandoned PRs on the source repo. Of note:
- pladaria/reconnecting-websocket#166 Fix: handle error if getNextUrl throws
- pladaria/reconnecting-websocket#132 feat: make protocols updatable
- pladaria/reconnecting-websocket#141 [Fix] Socket doesn't connect again after closing while connecting

(TODO: more)
- pladaria/reconnecting-websocket#163 Support for Dynamic Protocols
- pladaria/reconnecting-websocket#47 reconnecting and reconnectscheduled custom events
threepointone added a commit to partykit/partykit that referenced this pull request Jan 8, 2023
This forks `reconnecting-websocket` into our own package, and adds some functionality from abandoned PRs on the source repo. Of note:
- pladaria/reconnecting-websocket#166 Fix: handle error if getNextUrl throws
- pladaria/reconnecting-websocket#132 feat: make protocols updatable
- pladaria/reconnecting-websocket#141 [Fix] Socket doesn't connect again after closing while connecting

(TODO: more)
- pladaria/reconnecting-websocket#163 Support for Dynamic Protocols
- pladaria/reconnecting-websocket#47 reconnecting and reconnectscheduled custom events
@bj00rn bj00rn mentioned this pull request Aug 28, 2023
@Lonli-Lokli
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants