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
- Current User is Not authorized
recreating same Thread
- Apple OAuth Scopes
Hi Hi, I've configured sign in with apple and this is the response i'm getting from apple once i've signed in. I cant find anywhere I set scopes. I remember se...
- Sign In With Apple OAuth Help
Hi All! I've got a flutter & appwrite app which Im trying to use sign in with apple for. I already have sign in with google working and the function is the sam...