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

Give up on reconnections if token is invalid #633

Merged
merged 6 commits into from
Apr 14, 2023
Merged

Conversation

lukasIO
Copy link
Contributor

@lukasIO lukasIO commented Mar 29, 2023

Reconnect attempts will now fail immediately in case the reason for reconnection failing was the user being unauthorized to join

@changeset-bot
Copy link

changeset-bot bot commented Mar 29, 2023

🦋 Changeset detected

Latest commit: 0030ff1

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
livekit-client Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@lukasIO lukasIO marked this pull request as ready for review April 12, 2023 12:55
@lukasIO lukasIO requested a review from davidzhao April 12, 2023 12:55
Copy link
Member

@davidzhao davidzhao left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this change itself looks good. Though double checking when we'd consider it NotAllowed, it seems the current logic has a bug:

            const resp = await fetch(`http${url.substring(2)}/validate${params}`);
            if (!resp.ok) {
              const msg = await resp.text();
              reject(new ConnectionError(msg, ConnectionErrorReason.NotAllowed, resp.status));

it assumes any validate errors to be NotAllowed, including if it's a 500. I think we'd need to tighten that and compare if response code is 4xx (i.e. user error)

@lukasIO
Copy link
Contributor Author

lukasIO commented Apr 13, 2023

very good point! I had missed that.

Copy link
Member

@davidzhao davidzhao left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm!

@lukasIO lukasIO merged commit 95bd94e into main Apr 14, 2023
@lukasIO lukasIO deleted the lukas/surface-token-exp branch April 14, 2023 10:17
@github-actions github-actions bot mentioned this pull request Apr 14, 2023
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.

None yet

2 participants