Hello, In Flutter, after disposing my listeners, the console still shows the connections, what might be wrong?
@override
Future<RealtimeSubscription> getDoctorModelRealtimeSubscription(
DoctorModel value) async {
final rt = realtime.subscribe([
'databases.$DatabaseId.collections.$DoctorsCollectionId.documents'
]);
return rt;
}
....
StreamSubscription? _sub;
Future<void> _startRealtimeSubscription() async {
if (state.documentId.isEmpty || !mounted) return;
final realtimeSubscription =
await AsyncValue.guard(() => getDoctorModelRealtimeSubscription(state));
if (realtimeSubscription is AsyncData<RealtimeSubscription>) {
_sub = realtimeSubscription.value.stream.listen(_onRealtimeMessage);
}
}
@override
void dispose() {
_sub?.cancel();
super.dispose();
}
Are you using Appwrite cloud?
self hosting
What version?
1.3.7
Same version as I'm using π
I had something similar in flutter. Connection was cancelled but it remained
It's a weird behavior, I'm certain of my dispose methods but the connection is still there
If you close the app completely it stops?
a hot restart resets things yes
@D5 have you spent time around this issue?
Realtime Connections in Flutter do not get disposed!
I just found out thru some experiment that the following solves the issue
...
realtimeSub = realtimeSubscription.value;
...
realtimeSub?.close();
@D5 see if this can also solve yours.
Since up to 40 users connected through web simultaneously (the js app worked without issues) and there was only 1 flutter app user, sincerely I ignored the issue π
Seems it solves too
this one with leaky streams was already in production, I had to find a solution
but its fine as long as we dont have a million users simultaneously connecting lol
I'm marking this as solved then
[SOLVED] Realtime Connections in Flutter do not get disposed!
Recommended threads
- executeFunction intermittently throws Fo...
Environment: Flutter app using the Appwrite Flutter SDK, calling executeFunction for [describe endpoint, e.g. live-stream-related function]. *Description*: Int...
- How to update from 1.8.1 to 1.9.6
Due to the number of issues reported in version 1.9.5, I am hesitant to proceed with the update. Could anyone advise if version 1.9.6 is stable and resolves tho...
- HTTP Error 500 ''
Hello to everyone, I'm a Flutter developer and actually I'm developing an app using Appwrite.. during my tests and also massive ones I've noticed something we...