Back

[SOLVED] Realtime subscription null

  • 0
  • Flutter
  • Realtime
Joshima
8 Jun, 2023, 14:45

Mobile

TL;DR
The user is experiencing a "Realtime subscription null" error when loading user profiles in their app. Another user suggests using a different/new realtime instance. There is mention of a possible race condition with unsubscribing and subscribing in multiple places in the app, and it is recommended to use multiple realtime instances. One user suggests checking that the user id is not null when starting the subscription. The issue may be related to the web socket closing for some reason. There is a link to a code snippet that may help diagnose the issue. The problem seems to occur on app start up and is resolved when signing out and signing in again. There is
Drake
8 Jun, 2023, 14:52

womp..i don't think the dev tools logs web sockets very well...

Are you maybe subscribing before the user has a valid session?

Joshima
8 Jun, 2023, 18:44

but it does work when i sign out of appwrite and sign in again

Drake
8 Jun, 2023, 19:00

It could be something with the order of things being executed on app start up.

Joshima
8 Jun, 2023, 19:25

i am getting this in debug console - I/flutter (30045): subscription: null

Joshima
8 Jun, 2023, 20:20

how can i correct that

Joshima
8 Jun, 2023, 20:23

i just hot reloaded and it started working but then reloaded again and stopped working :_

Drake
8 Jun, 2023, 22:59

there's some race condition going on with your app such that the connection is being closed while another one is trying to start (you're unsubscribing and subscribing in multiple places of your app. Try to use multiple realtime instances

Joshima
9 Jun, 2023, 07:32

wdym 'unsubscribing' ?

Drake
9 Jun, 2023, 17:32

sorry, i mean when you call close() on the subscription

Joshima
9 Jun, 2023, 19:11

but i am not calling close() anywhere

Drake
9 Jun, 2023, 19:20

Realtime subscription null

Drake
9 Jun, 2023, 19:22

the web socket is closing for some reason 🤷🏼‍♂️

conqueror
10 Jun, 2023, 13:32

this is happening on app start ?

conqueror
10 Jun, 2023, 13:35

if this so then, check user id should not be null on startup or while calling subscription .this will remove the error. hope this will work

Joshima
10 Jun, 2023, 22:08

it worked, Thanks a lot dude!! @conqueror

Drake
10 Jun, 2023, 22:17

[SOLVED] Realtime subscription null

shiva
17 Jun, 2023, 08:24

i have the exact same problem and the exact same architecture but i am still to start a subscription at one place but not at other

Joshima
17 Jun, 2023, 08:54

Your realtime not working in user profile?

Joshima
17 Jun, 2023, 08:54

Or not even in user posts?

shiva
17 Jun, 2023, 08:55

realtime is working properly when trying to load new posts but when i go to a userProfile the error shows up

Joshima
17 Jun, 2023, 08:56

Ah I’m also kinda stuck there but I haven’t looked into it that much , I will let you know when it’s done

shiva
17 Jun, 2023, 09:00

ok thanks

Drake
17 Jun, 2023, 14:47

Try using a different/new realtime instance.

Btw, it's best to create a new post in <#1072905050399191082>

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more