
How to reconnect the realtime connection in Appwrite Flutter SDK when user leaves the app open in background connection closes after sometime and when user comes back to app realtime doesn't works.
same happens if user leaves the app open locks the phone and come back after sometime.
what is effecient way to reconnect?

I think basically starting the subscription again if the app gets killed

I would try having a foreground service or something else to prevent the app from being killed

App is not being killed that’s the problem 😂 I have logic set-upped that closes the connection when app gets killed and when app opens it gets connected.

It’s like keeping the app open but just not using it, staying idle

Is there some way to detect when the app becomes active?

No idea, at least in the latest app I used realtime, it even tried to restart the connection automatically when it was lost

There is a bug still in the flutter SDK where multiple subscribe calls on the same realtime instance causes the stream to stop emitting.
Otherwise, the stream has an onDone you can hook into for when the subscription closes

Okay so I need to create multiple real-time instances for each real-time connection

I’m not sure what you’re saying here? But this doesn’t sound right to me.

RealTime is class in Appwrite Flutter SDK. I’m saying for each unique connection I need to create new instance of RealTime class.

Ah - yes, that does sound correct!
Recommended threads
- I am facing this error: type 'Null' is ...
When attempting to fetch areas from the area collection, the application throws an error: "type 'Null' is not a subtype of type 'int.'" This issue originates in...
- Domain Verification failed
I think i did the step by step well but just not work. When I enter the page I have this error: `Requested host does not match any Subject Alternative Names (S...
- Adding Domain to Sites [Self Hosted]
I am struggling to get this working. I stood-up a new server and deployed appwrite 1.7.4. I added update .env file _APP_DOMAIN=appwrite.mydomain.com _APP_DOMAI...
