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

Use single state var to track connection state of signal client #949

Merged
merged 4 commits into from
Nov 30, 2023

Conversation

lukasIO
Copy link
Contributor

@lukasIO lukasIO commented Nov 29, 2023

previously we had isConnecting and isReconnecting as two boolean values, with the possibility to create ambigious states.
This PR instead uses a singe SignalConnectionState to track the current signal client connection status.

(hide whitespace recommended for review)

Copy link

changeset-bot bot commented Nov 29, 2023

🦋 Changeset detected

Latest commit: 7b0ea45

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 requested a review from davidzhao November 29, 2023 16:20
Copy link
Contributor

github-actions bot commented Nov 29, 2023

size-limit report 📦

Path Size
dist/livekit-client.esm.mjs 78.53 KB (0%)
dist/livekit-client.umd.js 84.08 KB (0%)

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.

nice! much cleaner

@@ -1129,7 +1130,7 @@ export default class LocalParticipant extends Participant {
) {
this.participantTrackPermissions = participantTrackPermissions;
this.allParticipantsAllowedToSubscribe = allParticipantsAllowed;
if (this.engine.client.isConnected) {
if (this.engine.client.currentState < SignalConnectionState.DISCONNECTING) {
Copy link
Member

Choose a reason for hiding this comment

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

it'd be better to abstract the enum math under something like a get isDisconnected():boolean

@lukasIO lukasIO merged commit 77301cb into main Nov 30, 2023
3 checks passed
@lukasIO lukasIO deleted the lukas/signal-single-state branch November 30, 2023 13:10
@github-actions github-actions bot mentioned this pull request Nov 30, 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.

2 participants