I am using appwrite for my backend project. and for the getx state manager. So far, everything is fine with me except for realtime. Please explain how the real-time application recording mechanism works. I have seen many video tutorials and read many articles. How can I get it through the stream? I repeated everything exactly as in the video, but it does not work. How to know if the callback fired or not. In the console it only says that the subscription has been created and that's it. there is nothing more. How to get data from this stream.
//
I have a subscription but I can't get a response//
subscription: ws://195.49.210.221/v1/realtime?project=jetservice_server&channels%5B%5D=collection.77079959596.documents
get_realtime_chat_list() async {
var realtime_chat = await serverProvider.realtime.subscribe([
'collection.' +
userdata.userDataStorage.value.read(my_phone) +
'.documents'
]);
realtime_chat.stream.listen((data) {
try {
if (data.payload.isNotEmpty) {
switch (data.events) {
case ['collection.document.create']:
print(data.payload);
break;
case ['collection.document.delete']:
print("document_deleted");
}
}
print(realtime_chat);
} on AppwriteException catch (e) {
print(e.message);
}
});
}