-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
馃悰 Bug Report: RealtimeSubscription fails to work when document is being listened to multiple times by the same client #6515
Comments
Where and how is realtime defined? |
In a separate dart file
|
@arrowxpr would you please provide more details about that separate file? |
Absolutely. Here is the content of mentioned dart file.
|
This doesn't quite make sense...I don't think you can have getters and whatnot like this in a file by itself 馃 |
I originally noticed the issue while using those getters, and then I even instantiated new Realtime objects because I suspected something, and the issue persisted. And I wonder why it does not make sense? Please do enlighten my knowledge. |
@arrowxpr, unfortunately, I have not been able to reproduce your problem. In my test, i have a _subscribe(List<String> channels) {
final realtime = Realtime(widget.client);
final subscription = realtime.subscribe(channels);
subscription!.stream.listen((data) {
print(data);
setState(() {
realtimeEvent = jsonEncode(data.toMap());
});
});
setState(() {
final hashCode = _getHashCode(channels);
subscriptions[hashCode] = subscription;
});
} Using this, I subscribed to |
I am not sure if you tried cancelling and then starting those subscriptions again within 5 seconds. I keep reproducing this bug in my project. |
It seems related to
|
馃憻 Reproduction steps
Plugins:
Let's get some stuff done first
1. Create a database with the ID
itemListDatabaseId
2. Create a collection inside it with the ID
itemListCollectionId
3. Add some random attributes (e.g. name)
4. Create a new document with the ID
myNewDocument
5. Prepare an Appwrite server client, I'm using Dart, and add the following code:
6. Copy paste the following code into your Flutter project and implement the remaining TODO
7. Now run the loop to update the document and do the following in the Flutter app
In the ItemListViewScreen, Tap the item to move to ItemViewScreen... And Go back (exit)
Repeat this a few times, and each time you open the new window notice your console logs before exiting. If the events were being printed out then exit the screen.
Doing this a few times will result in the realtime sub to not deliver any events, it's random and not clear exactly how frequently this process will produce the mentioned bug.
8. If you found the bug in step 7, then do the following to confirm the bug does exist.
In your ItemListView comment the code where we started the realtime subscription (this will require you to add a fetching functionality to fetch the document, or just hard code the myNewDocument's ID into a UI item so that you can click on it and move to ItemViewScreen and supplying the document's ID.
If you did not reproduce the behavior of step 7 in step 8 then we can confirm that the bug does exist.
馃憤 Expected behavior
This is a case where we want to use multiple streams on a single document. The streams should be consistent on delivering the events.
馃憥 Actual Behavior
As mentioned above, the Realtime Subscription stops working at times when the document is being listened to multiple times by the same client.
馃幉 Appwrite version
Version 1.4.x
馃捇 Operating system
Linux
馃П Your Environment
No response
馃憖 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: