Hello everyone,
I've been using Appwrite recently, and I have a question regarding realtime that I haven't found an answer to in the documentation.
First of all :
When I initialize my app, I create a "RealtimeSubscription" on "account". I add a listener to react to account changes, and I "close()" / recreate the "RealtimeSubscription" at each login / logout (as specified in the documentation). This whole part works perfectly.
Afterwards :
When the user opens a page with data that must be updated in real time, I create a "RealtimeSubscription" which manages the change in certain documents in the database. This whole part works perfectly.
My issue is the following:
When I open the updated page in realtime, the user part disconnects instantly, and it's the same for the realtime of the page. I have console messages "subscription null" alos that I absolutely did not want the disconnection.
I think I have a poor understanding of Realtime on this aspect of channel/subscription, can you enlighten me?
Sincerely, Disk_MTH
Platform?
Flutter, it's in the tag post π
Some words in your desc are in French, do you speak french ?
my bad, i missed it.
no problem
no, btw I don't see anything french though in my profile's desc π
my bad the word "Entrepreneur" is the same in both English and French
but as French preople it doesn't sound as a English term
Could you try creating a singleton of Realtime(client)
& use that instance across app & see if the disconnection still happens?
I've seen this in apple sdk quite a few times randomly.
Also, appwrite 1.4x with latest sdk?
I've a singleton of Realtime, and I use only this singleton but when I try to subscribe to two channels in the same class, it work, both are updated, but if on is declared, and another when the page show up, both are killed and I dont understand why
on my pubspec.yaml : appwrite: ^11.0.0
it's the last one : https://pub.dev/packages/appwrite
Can you try using subscribe with multiple channels with a singleton subscription? Does that work?
This is what I had thought of using first (it seemed logical to me) but it was when I saw the documentation which said that at each connection/disconnection, it was necessary to stop the realtime and recreate it that I said to myself that I was going to separate the different streams. So I just remerged everything and it works for now (I haven't finished everything yet). On the other hand, contrary to the documentation, I do not need to recreate my channel each time to always have the updates. I'll continue and post if it's definitely fixed or not.
There might still be a bug with the flutter SDK and realtime. For now, can you try using separate realtime instances for each subscription?
That's what I tested basically, and that's what's the problem. I did otherwise: I made 1 single realtime that makes both my accounts and my collections and at each change of account status, I re-call "listen" on my realtime and it works
[SOLVED] Multiple realtime channels with Account
Recommended threads
- 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...
- [SOLVED] OAuth With Google & Flutter
Hi all, I'm trying to sign in with google and it all goes swimmingly until the call back. I get a new user created on the appwrite dashboard however the flutte...