Back

Realtime disconnect

  • 0
  • Flutter
  • Realtime
Karthik
26 Oct, 2023, 03:43

i am building a chat app but i notice if i leave chat app without using for a hour + realtime get disconnected and also if the user changes the IP then also realtime get disconnect whats the best method to check if realtime is working and reconnect it if not working.

TL;DR
The user is experiencing issues with their realtime functionality in their chat app. They suspect that the onDone callback is not being triggered when the IP changes. They are using version 11.0.0 of the Appwrite SDK. They have noticed that when they switch between mobile network and broadband, realtime stops working. Sometimes, switching back to the original IP allows realtime to work again. The user is using permissions for three users on a document and is encountering an "Invalid `permissions` param" error when trying to post data after changing IP. They are wondering if calling subscription.close() will trigger onDone. They are looking for the best
Drake
26 Oct, 2023, 03:44

When you listen to the stream, there's an onDone callback you can use to reconnect or whatever you want

Karthik
26 Oct, 2023, 03:46

ok let me check that

Karthik
26 Oct, 2023, 03:52

will on done get triggered if i call subscription.close() ?

Drake
26 Oct, 2023, 04:16

I think so

Karthik
26 Oct, 2023, 05:10

if i switch ip ondone is not triggering when i switch back to same ip the message get delivered in realtime.

Karthik
26 Oct, 2023, 06:34

when i change internet ip and come back to same ip and try to post a data i am also hit with this error: AppwriteException (AppwriteException: general_argument_invalid, Invalid permissions param: You can only provide up to 100 permissions. (400)) . what is this error ?

Karthik
26 Oct, 2023, 06:35

i am only give permission to 3 users to a document

Drake
28 Oct, 2023, 00:46

maybe print the permissions before making the API call

Drake
28 Oct, 2023, 00:47

what exactly is the real world use case for ip changing?

Karthik
30 Oct, 2023, 16:30

In chat if a customer is using broadband fiber connection if they loose a connection they get new ip when they reconnect

Drake
30 Oct, 2023, 17:51

Wouldn't they disconnect from the internet so the web socket connection would close?

ideclon
30 Oct, 2023, 17:56

Not necessarily - some ISPs rotate customer IPs as often as twice a day.

Karthik
30 Oct, 2023, 18:25

for testing i switch between mobile network and broadband. when i switch realtime stop working. ondone or onerror no getting called. when i switch back realtime sometimes work and get all messages.

Drake
30 Oct, 2023, 18:53

What version of the Appwrite SDK?

Karthik
2 Nov, 2023, 06:23

Appwrite 11.0.0 , when kept idle for a 4 hours realtime still works i think idle issue is fixed. But switching ip is the issue.

Drake
14 Nov, 2023, 00:51

Can you check if the onDone is being triggered?

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more