
Hi, I've many realtime provider on my app, but something some of them return null when subscribing, so I never get any update.
I use riverpod for managing my provider. I've found a way to solve it by creating many instance for my realtime provider, but I don't know if it is a good practice.
Can I create many realtime client like this : final realtime = Realtime(client); and create a subscription
Or the best way is to create only one client and many subscription ?

Every time you're running.
final realtime = Realtime(client);
You're creating a new socket to your server which can become overwhelming pretty fast. https://github.com/appwrite/sdk-for-flutter/blob/master/lib/src/realtime_io.dart#L35
I think the best way would be one client with multiple subscriptions, and check each time what you got. And in case you got null / empty ones just ignore them.

Yes, but when I do this, some subscription return me null and I never get notified :/

You get a completely null? like all the is just null?

Yes, in the log, i got only "subscription : null", it come from this line : "debugPrint('subscription: $_lastUrl');" in the method _createSocket in the class RealtimeMixin.

Are you running against Appwrite cloud or a self-hosted one?

self hosted (1.2.1)

So you can run
docker logs appwrite-realtime
To see if any obvious errors are shown.
Also, when you can backup, and upgrade your instance. (using migration scripts)

Yes, it is planned, i'll do that next week 🙂

Have you seen anything suspicious in the logs?

I've just receive a null subscription on my client, but on the server, nothing warm me : Connection open (user: 2025)
Connection open (user: 2026)
Connection open (user: 2027)
Connection open (user: 2028)
Connection close: 2020
Connection open (user: 2029)
Connection open (user: 2030)
Connection close: 2030
Connection open (user: 2031)
Connection close: 2031
Connection close: 2029
Connection open (user: 2032)
Connection close: 2025
Connection close: 2028
Connection close: 2026
Connection close: 2027
Connection open (user: 2033)
Connection open (user: 2034)
Connection open (user: 2035)
Connection open (user: 2036)
Connection open (user: 2037)
Connection close: 2035
Connection open (user: 2038)
Connection close: 2038
Connection open (user: 2039)
Connection close: 2037
Connection open (user: 2040)
Connection close: 2040
Connection open (user: 2041)
Connection open (user: 2042)
Connection open (user: 2043)
Connection close: 2036
Connection close: 2033
Connection close: 2034
Connection close: 2039
Connection open (user: 2044)
Connection close: 2043
Connection close: 2042
Connection close: 2041
Connection open (user: 2045)
Connection close: 2044
Connection open (user: 2046)
Connection close: 2046
Connection open (user: 2047)
Connection open (user: 2048)
Connection open (user: 2049)
Connection open (user: 2050)
Connection open (user: 2051)
Connection close: 2051
Connection open (user: 2052)
Connection open (user: 2053)
Connection open (user: 2054)
Recommended threads
- Relationships restricted to a max depth ...
When I do query like: ``` await _databases.listDocuments( databaseId: AppwriteConfig.DATABASE_ID, collectionId: AppwriteConfig.SERVICES_COLLECTI...
- realtime failing
Hi everyone! I'm running into a weird issue with Appwrite realtime in my chat app and was hoping someone might have some insights. I have a chat view, and whe...
- Error sending push message from dashboar...
I am trying to implement appwrite fully into my app and am switching over from firebase. I registered FCM as a Provider and tried to send a push message via the...
