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.
Summary
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
Oct 26, 2023, 03:44
When you listen to the stream, there's an onDone callback you can use to reconnect or whatever you want
Karthik
Rank 2: Process
Oct 26, 2023, 03:46
ok let me check that
Karthik
Rank 2: Process
Oct 26, 2023, 03:52
will on done get triggered if i call subscription.close() ?
Drake
Oct 26, 2023, 04:16
I think so
Karthik
Rank 2: Process
Oct 26, 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
Rank 2: Process
Oct 26, 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
Rank 2: Process
Oct 26, 2023, 06:35
i am only give permission to 3 users to a document
Drake
Oct 28, 2023, 00:46
maybe print the permissions before making the API call
Drake
Oct 28, 2023, 00:47
what exactly is the real world use case for ip changing?
Karthik
Rank 2: Process
Oct 30, 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
Oct 30, 2023, 17:51
Wouldn't they disconnect from the internet so the web socket connection would close?
ideclon
Oct 30, 2023, 17:56
Not necessarily - some ISPs rotate customer IPs as often as twice a day.
Karthik
Rank 2: Process
Oct 30, 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
Oct 30, 2023, 18:53
What version of the Appwrite SDK?
Karthik
Rank 2: Process
Nov 2, 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.