I'm unfortunately out of ideas for now. I sugges you wait for someone else to respond 😅
yeah anyways thanks for responding
can you please share your project linkg (if possible) please?
he followed this videos - https://youtu.be/XnxZLhtkFeg
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
i will try the second suggestion
and by authentication,you mean to check weather the currentUser==null or not?
After you call account.get() successfully
yeah thats done initially for the whole app
Yes, but just make sure you subscribe after that
isnt that already ensured when i have a valid session going on or after i have logged in successfully?
making different instance ain't working either
It depends on how your app is set up
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?
we are building the same project and i think he has tried it and its not working
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()
wait wait it is working now
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 userApiProvider
and then make another instance like i shared above
it will start working then
thanks @Steven
thanks @Steven mine also worked🤩
[SOLVED] Realtime Subscription Null
Recommended threads
- Realtime: Listener not triggered on upda...
I self host appwrite 1.8.1. The genereal functionallity works fine. But my realtime subscription isn't updating. I see "Received heartbeat response from realtim...
- Realtime for files() works almost well, ...
I have been trying to make use of realtime, today (14.03.26) I have pulled all the latest versions of docker images, and sdk available. Whats working: - Conn...
- Impossible to get USER after createEmail...
Am using provider to deal with functions linked to appwrite. Here is my login. Future<String?> login(String email, String password) async { try { aw...