-
Notifications
You must be signed in to change notification settings - Fork 25
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
Multiple ARTMessage being sent to the app after reestablishing connection from disconnection #1933
Comments
Hi @renbevz, would you be able to share some extended logs showing the "Disconnected to Ably!" output too please? |
Isn't it just the same message printed twice? The object address is the same (and the message id too). @renbevz @umair-ably |
Hi @umair-ably , Here's the logs for reference:
|
Hello @umair-ably here's the complete logs that I have prepared that the app is using. Please let me know if this would suffice. Thank you.
|
Hey @renbevz, the issue lies in subscribing in the connected state case within the connection changed closure. This means you'd have N number of subscriptions (and printed messages) for the N number of times you disconnect and reconnect. Instead, you only need to subscribe once, and outside of any callbacks like below; Ably handles the receiving of messages after reconnecting for you without the need to subscribe again.
It's worth keeping in mind you'll need to use an appropriate pattern for your use case in case your application tries to subscribe to the same channel after backgrounding/foregrounding the app, or perhaps calling |
Hello @umair-ably , Sorry for the very late response on this as I just recently circled back the implementation of Ably on the project and currently upon checking, the app weren't doing such reinitialization or resubscription of connection, unless the user did delete the app or the user log out and log in again. This line of code is only executed once after logging in
The only scenario that I did on the app is to disconnect and reconnect the internet connection in which it doesn't involve any closing of connection and staying with only with one instance of Ably which which shows the status of the connection. Please let me know if you need to know more details about this. Thank you as always for answering my queries and apologies for the late response on this. |
Hello and good day!
Which version of the Ably SDK are you using?
1.2.32
On which platform does the issue happen?
iOS17.5.1
Are you using Carthage?
no
Are you using Cocoapods?
yes,
Which version of Xcode are you using?
15.3
What did you do?
Describe the problem.
I let the application simulate the disconnection to see if ably would handle the reconnection seamlessly which it did but it causes the app to receive multiple ARTMessage
Add a short snippet of code to show the problem
What did you expect to happen?
Should only receive 1 ARTMessage just like on the first launch
What happened instead?
Was able to receive 2 or more ARTMessage
Add relevant console logs.
Thank you for your assistance on this.
┆Issue is synchronized with this Jira Task by Unito
The text was updated successfully, but these errors were encountered: