-
-
Notifications
You must be signed in to change notification settings - Fork 38
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
Improve behavior for realtime channel creation and improve docs #831
Conversation
Hi @jan-tennert this isn't how realtime-js works, on js it can exist multiple channels for the same topic, as its hold by an array. Tho I do think that the behavior of not having duplicate channels should be the correct, I'm not sure why it is that way, so tagging @filipecabaco for discussion. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
blocking until correct behavior is discussed
Yea, I saw that, was actually going to ask about this because the Swift V2 Code also uses a map instead of an array |
Yes @jan-tennert Swift follows Kotlin's behavior, which is also not aligned with JS. |
Swift and Kotlin are more correct. We should do the same on JS as when you subscribe to a topic it should have a "unique" name so this looks like a bug from realtime-js 🤔 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approved as Filipe confirmed this is the correct behavior, I'll do the same for Swift.
Just not sure we can do the fix on JS as it seems it will be a breaking change.
What kind of change does this PR introduce?
Docs update / Improvement (closes #818)
What is the current behavior?
Calling
Realtime#channel()
will always create a new channel and override the existing one, if there is one by the given channel id. Also the docs are not very clear.What is the new behavior?
Realtime#channel()
will now also return an existing channel, if there is one.