I'm unfortunately out of ideas for now. I sugges you wait for someone else to respond 😅
[SOLVED] Realtime Subscription Null
Votes
0
Replies
24
Participants
Unknown
Messages
25
Rank 1: Thread
yeah anyways thanks for responding
can you please share your project linkg (if possible) please?
Rank 2: Process
he followed this videos - https://youtu.be/XnxZLhtkFeg
Rank 2: Process
most of the people getting this problem only in user profile realtime not in user posts realtime
Can you try to make sure to subscribe only after making sure you're authenticated and also use a separate realtime instance for each subscription
Rank 1: Thread
i will try the second suggestion
Rank 1: Thread
and by authentication,you mean to check weather the currentUser==null or not?
After you call account.get() successfully
Rank 1: Thread
yeah thats done initially for the whole app
Yes, but just make sure you subscribe after that
Rank 1: Thread
isnt that already ensured when i have a valid session going on or after i have logged in successfully?
Rank 2: Process
making different instance ain't working either
It depends on how your app is set up
Rank 1: Thread
yeah in my app its ensured but the problem is still there .....however i am unable to understand how realtime works at one place flawlessly but on another screen its showing subscription:null message
And you're using a separate realtime instance? What's your new code?
Rank 1: Thread
we are building the same project and i think he has tried it and its not working
Rank 2: Process
In API i used final Realtime _realtimes; whereas I used this - final Realtime _realtime; in user posts and here is my API function accordingly - @override Stream<RealtimeMessage> getLatestUserprofileData() { return _realtimes.subscribe([ 'databases.${AppConstants.APPWRITE_DATABASE_ID}.collections.${AppConstants.APPWRITE_USERS_COLLECIION}.documents' ]).stream; }` provider - `final getLatestUserProfileDataProvider = StreamProvider((ref) { final userAPI = ref.watch(userAPIProvider); return userAPI.getLatestUserprofileData(); });` UI page - `currentUser == null ? const Loader() : SafeArea( child: Scaffold( body: ref.watch(getLatestUserProfileDataProvider).when( data: (data) { if (data.events.contains( 'databases.*.collections.${AppConstants.APPWRITE_USERS_COLLECIION}.documents.${copyOfUser.uid}.update', )) { copyOfUser = UserModel.fromMap(data.payload); } return UserProfile(user: copyOfUser); }, error: (error, st) => ErrorText( error: error.toString(), ), loading: () { return UserProfile(user: copyOfUser); }, ), ), );` here currentUser is a provider for `account.get()
Rank 2: Process
wait wait it is working now
Rank 2: Process
make another provider for it - final apppwriteRealtimeProvider = Provider((ref) { final client = ref.watch(appwriteClientProvider); return Realtime(client); }); - provider for user posts
final client = ref.watch(appwriteClientProvider); return Realtime(client);});``` - provider for userprofile and don't forget to use this provider in userApiProviderRank 2: Process
and then make another instance like i shared above
Rank 2: Process
it will start working then
Rank 2: Process
thanks @Steven
Rank 1: Thread
thanks @Steven mine also worked🤩
[SOLVED] Realtime Subscription Null