
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
- Realtime Disconnects and Error: INVALID_...
Hi! I just want to ask here if there's any workaround with the disconnect issues we're encountering when subscribing to realtime events in react native using ex...
- Redirect URL sends HTTP instead of HTTPS...
I am not sure since when this issue is present, but my Google and Apple redirect URI are no longer pointing to the HTTPS redirect URI when I try to use OAuth. ...
- Failing to run document operations on sd...
Could someone point me in the right direction I'm going in cirlces. I have a problem with sdks and my self-hosted server in production (for ~3 years) I have bee...
