
Hi! I just want to ask here if there's any workaround with the disconnect issues we're encountering when subscribing to realtime events in react native using expo and also having this INVALID_STATE_ERR
.
ERROR Realtime got disconnected. Reconnect will be attempted in 1 seconds. Stream end encountered
ERROR Error: INVALID_STATE_ERR, js engine: hermes
Here's how we implemented in subscribing for realtime events based off on your documentations:
useEffect(() => { let unsubscribe = null;
const setupRealtimeListeners = async () => {
try {
unsubscribe = client.subscribe(
[
`databases.${secrets.appwriteConfig.databaseId}.collections.${secrets.appwriteConfig.messagesCollectionsId}.documents`,
`databases.${secrets.appwriteConfig.databaseId}.collections.${secrets.appwriteConfig.chatsReadCollectionId}.documents`,
],
(response) => {
if (response.payload?.$collectionId === secrets.appwriteConfig.messagesCollectionsId) {
handleRealTimeMessagesEvents(response);
} else if (response.payload?.$collectionId === secrets.appwriteConfig.chatsReadCollectionId) {
handleRealTimeMessageReadEvents(response);
}
},
);
} catch (err) {
console.error("Realtime not ready or subscription failed:", err);
}
};
setupRealtimeListeners();
return () => {
if (unsubscribe) unsubscribe();
chatIdRef.current = null;
};
}, []);
@Cara Santos @Luis P. @Ian R.
Recommended threads
- import csv "Document already exists"
When I try to import a csv file to an already existing database, I keep getting "Document Already Exists" I thought that when I import and a document with the ...
- Database not found
Even though I can clearly access and update fields in my DB through the console, when my updating through the Android SDK it throws this error { "message": ...
- Cannot load nested relationships
When trying to load a nested relationship using the below query I get this error: ```Invalid query: Attribute not found in schema: *``` ```dart try { fina...
