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

Provide an easy way to add/remove ably channel state listeners #964

Open
AndyTWF opened this issue Jan 30, 2023 · 3 comments
Open

Provide an easy way to add/remove ably channel state listeners #964

AndyTWF opened this issue Jan 30, 2023 · 3 comments
Labels
bug Something isn't working. It's clear that this does need to be fixed. code-quality Affects the developer experience when working in our codebase.

Comments

@AndyTWF
Copy link
Contributor

AndyTWF commented Jan 30, 2023

In #963, we had to introduce a local boolean check in two places to prevent duplicate resumptions of continuations related to ably channel state changes (the duplicates call exceptions to be thrown).

This was necessary because in Ably.kt (DefaultAbly) we wrap the standard Ably state change listeners in our own classes, meaning we cannot get the object that's registered with ably to be able to call channel.off(). We also have to send the "initial" state before the listener is attached to the channel, which presents a race condition. Changing this would require some careful thinking, so in the interest of time we added the work-around to solve the issue in the short term.

We should look to go back and readdress this so that we use the standard channel.off() way of unsubscribing listeners (and listeners can unsubscribe themselves) in the future.

@AndyTWF AndyTWF added bug Something isn't working. It's clear that this does need to be fixed. code-quality Affects the developer experience when working in our codebase. labels Jan 30, 2023
@AndyTWF
Copy link
Contributor Author

AndyTWF commented Jan 30, 2023

Note this code has now been moved into Ably.kt, but remains the same principle.

@deanna-lad
Copy link

The corresponding Jira issue is https://ably.atlassian.net/browse/SDK-3291

@sync-by-unito
Copy link

sync-by-unito bot commented Jun 29, 2023

➤ Automation for Jira commented:

The link to the corresponding Jira issue is https://ably.atlassian.net/browse/SDK-3291

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working. It's clear that this does need to be fixed. code-quality Affects the developer experience when working in our codebase.
Development

No branches or pull requests

2 participants