Back

Realtime doesn't send any events anymore

  • 0
  • Self Hosted
  • Databases
  • Realtime
Tobi696
15 Mar, 2025, 12:01

I have a searches database and I listen to specific documents (the search the user created) by id to display the search results in realtime in my nextjs frontend. This part was working and I'm pretty sure I haven't changed any code there the last few months, but now I noticed that no events get sent on the websocket anymore.

TL;DR
Realtime events not being sent in code despite no recent changes made. Code includes listening to specific documents in a database for frontend display. Only receiving a "connected" event in the console. Solution: Check websocket connection, permissions on the collection, and verify the correct data is being logged in the console.
Tobi696
15 Mar, 2025, 12:03

Here's my code:

TypeScript
useEffect(() => {
    console.log(initialSearch.$id);
    const unsubscribe = client.subscribe(`databases.${db}.collections.${searchesCollection}.documents.${initialSearch.$id}`, (e) => {
        console.log("update");
    });
    return () => {
        unsubscribe();
    };
    // eslint-disable-next-line react-hooks/exhaustive-deps
}, []);
Tobi696
15 Mar, 2025, 12:05

This is the only event I receive in the browser console:

TypeScript
{
    "type": "connected",
    "data": {
        "channels": [
            "databases.project.collections.searches.documents.67d56cb800173a00b735"
        ],
        "user": null
    }
}
Tobi696
15 Mar, 2025, 12:06

The permissions on my collection should also be fine

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