Hi,
After upgrading Flutter Appwrite from version 8.2.0 to 9.0.1, I have faced these issues...
First Issue was, I was using single Realtime instance for creating all the subscriptions for multiple channels but on 9.0.1 when I tried to subscribe to multiple channels the subscription gets set to 'subscriptions:null' automatically when the second channel was added. Basically it was setting and cancelling the subscription when I added the second channel.
but, I found a solution for this issue and used different realtime instances for each channel/subscription and it worked. Seems like one realtime instance can handle only one channel in the 9.0.1 version, in 8.2.0 I could subscribe to multiple channel using one instance of Realtime.
So Basically, its working fine now but the new issue I am facing regarding this is that For example, I subscribe to a 'test' channel it works okay and I get updated but after some time maybe (4-5 minutes or more) the updates from realtime stops as if the connection is closed and when in that scenario i try to cancel or close the realtimesubscription it gives me the error
'Null check operator used on a null value' From this part of the code:
'realtime_mixin.dart' Line 141: "_channels[channel]!.remove(controller);"
I would like to know if there is any timeout limit for realtimesubscription that I am not aware of so I can change it.
My Appwrite backend is hosted on Apache Server.
Known issue: https://github.com/appwrite/sdk-for-flutter/issues/156. maybe you can use different realtime stances for now? or downgrade?
I am using different instances of realtime for now, it works but the new problem is if the connection is idle (received no update) it is closed auto after that no updates are received
Your apache server probably has a timeout on connections. You'll need to find out the directive to set the timeout for websocket connections
Timeout is not the issue here I guess, I have a web site with realtime too but that works fine without any connection issues.
But, I will still look into apache side again in timeout case.
Hello @Steven ,
I have changed Apache Timeout directive it actually works and realtime does not disconnect.
But, when I access my appwrite backend directly using the actual port where it is hosted then again it still disconnects realtime without any reverse proxy in between. A clear cut direct connection to Appwrite but it still disconnects. Version 1.3.8
Although in version 1.3.4 It seemed okay (Or maybe using one realtime instance kept the socket alive on adding and removing channels)
I have tried to add varnish cache control, but it doesn't work.
Thanks, Rehan
how long before disconnect? is this a mobile app? is it in the foreground the whole time wiht the screen on?
It is a mobile app yes, yes It is in the foreground with the screen on, Although I will confirm on the time.
Can you please let me know something about Apache Lag issue?
sorry, dunno about apache
Hmm alright, not sure why so much lag for using reverse proxy
Well, timeout on direct connection to Appwrite which is direct to Traefik is more than 5-6 minutes
but through apache it's longer?
On apache it depends on Timeout directive
Also can you please tell me why I am seeing this error
Also please resolve this Flutter SDK realtime issue. Where we have to use different Realtime Instances. They open up multiple connections to Appwrite from one device which I think is not good.
@Steven I need urgent support from a Core person understanding of Appwrite and urgently
Yes I worked on that, I need urgent help with something else. I have migrated from 1.3.8 to 1.4.1 and I can not upload functions anymore.
Getting this error in image. then I tried to migrate back to 1.3.8 and it Failed with error and Functions show 500 in console and then migrated back to 1.4.1 but I can not upload functions because of this error. @Steven
SOLVED: Realtime Issue with Flutter - Subscription auto expires
we need to push a release to fix https://github.com/appwrite/appwrite/pull/6095
Okay, although I did that change and is now using custom image for now. Should I remove SOLVED?
no because the original problem was solved
Recommended threads
- Send Email Verification With REST
I am using REST to create a user on the server side after receiving form data from the client. After the account is successfully created i wanted to send the v...
- Use different email hosts for different ...
Hello, I have 2 projects and i want to be able to set up email templates in the projects. Both projects will have different email host configurations. I see ...
- Migrate from cloud to localhost
Hello everyone. I need to migrate my test project from cloud to localhost, however it seems that this is possible only if a self-hosted appwrite instance it's h...