-
Notifications
You must be signed in to change notification settings - Fork 111
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
🐛 Bug Report: Subscribing Multiple Times with a Single Realtime Instance Results in Null Subscription #156
Comments
For now, the best thing to do is to use a separate Realtime instance for each subscription. |
@stnguyen90 what is the behavior with other SDKs? |
@lohanidamodar, it works fine in other SDKs. You can use 1 realtime instance and make multiple subscribe calls. The problem with our Flutter SDK is how we handle reconnects. |
Same issue with me |
Same here. |
This needs addressing, really handicaps one of the most useful features. |
Same here, what is the status of this issue? |
same here. Thank you for the work. |
Hey, we have a work in progress fix for this issue, if you could test the SDK from this branch and let us know that would be great dependencies:
appwrite:
git:
url: https://github.com/appwrite/sdk-for-flutter
ref: fix-realtime-multiple-subscription |
I have just tested the SDK from the |
Thank you for your validation. Will work to get it released soon. |
I tried this patch and an error occurs when restarting the realtime stream whenever it closes Here's the stacktrace
|
@Andree98 can you share code to reproduce this error |
@lohanidamodar I'm able to reproduce the stacktrace with this code
Run the app and wait for the subscription to be killed. For me this takes 2-3 minutes using Cloudflare proxy. when the subscriptions are killed the stacktrace will appear in the console |
@lohanidamodar Same issue with me, is the work in progress? Thanks |
Latest release should resolve this issue. |
Hello and thank you for your help! |
👟 Reproduction steps
👍 Expected behavior
You get 2 separate working subscriptions
👎 Actual Behavior
log:
The subscriptions don't receive any events.
It looks like the 2nd subscribe closes the websocket, which triggers:
sdk-for-flutter/lib/src/realtime_mixin.dart
Lines 85 to 86 in 54f30fa
The
_closeConnection()
results in the_lastUrl
being set tonull
:sdk-for-flutter/lib/src/realtime_mixin.dart
Line 27 in 54f30fa
and the
_channels.clear()
prevents future events from being dispatched properly:sdk-for-flutter/lib/src/realtime_mixin.dart
Lines 71 to 75 in 54f30fa
🎲 Appwrite version
Different version (specify in environment)
💻 Operating system
Linux
🧱 Your Environment
Tested with SDK version 9.0.0 and Appwrite version 1.3.4. For some reason, this only happens on mobile and not on flutter web.
👀 Have you spent some time to check if this issue has been raised before?
🏢 Have you read the Code of Conduct?
The text was updated successfully, but these errors were encountered: