Back

Is realtime API down?

  • 0
  • Web
  • Realtime
  • Cloud
Florin Pop
15 Jul, 2024, 11:15

and I'm waiting to see the update (and the console log)

TL;DR
Developers are experiencing issues with the Realtime API, leading to events not firing consistently. Some possible solutions include checking network connections or potential limitations on simultaneous connections. One developer shared their code snippet for troubleshooting. The problem seemed intermittent, with the API sometimes working and sometimes not.
D5
15 Jul, 2024, 11:17

Hmmm unsubscribe is actually subscribing 🤔

Florin Pop
15 Jul, 2024, 11:17

well, that's just me storing the unsubscribe method

Florin Pop
15 Jul, 2024, 11:17

so that I can call it at the end of the useEffect

Florin Pop
15 Jul, 2024, 11:18
TypeScript
useEffect(() => {
    getQuestionsFromDB();

    const unsubscribe = client.subscribe(
        `databases.${DB_ID}.collections.${COLLECTION_ID}.documents`,
        (res) => {
            console.log({ res });

            if (
                res.events.includes(
                    "databases.*.collections.*.documents.*.update"
                )
            ) {
                setQuestions((prevQuestions) => {
                    return prevQuestions.map((question) => {
                        if (question.$id !== res.payload.$id) {
                            return question;
                        }

                        return res.payload;
                    });
                });
            }
            console.log("UPDATED QUESTIONS");
        }
    );

    return () => {
        unsubscribe();
    };
}, []);
Florin Pop
15 Jul, 2024, 11:18

this is the entire useEffect inside of my App.jsx

Florin Pop
15 Jul, 2024, 11:18

this code worked, I haven't changed anything but then the event stopped firing

Florin Pop
15 Jul, 2024, 11:19

are there any limitations? 🤔

Florin Pop
15 Jul, 2024, 11:19

btw, the update method works too, I just don't get the realtime event and I have to manually refresh the page

D5
15 Jul, 2024, 11:20

If i remember it well, the only limitation was that you can't have a lot of simultaneous connections

D5
15 Jul, 2024, 11:20

But I think it's not the case

D5
15 Jul, 2024, 11:20

Thai is Appwrite cloud, right?

Florin Pop
15 Jul, 2024, 11:20

no, I'm just testing this on localhost

Florin Pop
15 Jul, 2024, 11:20

yes

D5
15 Jul, 2024, 11:20

Ok. Do you can send me your project ID?

Florin Pop
15 Jul, 2024, 11:21

sure: 6694b8f8000ff3696830

D5
15 Jul, 2024, 11:22

cc @Steven

Florin Pop
15 Jul, 2024, 11:22

ok, now it seems to be back

Florin Pop
15 Jul, 2024, 11:22

🤷‍♂️

Florin Pop
15 Jul, 2024, 11:22

no changes in my code

D5
15 Jul, 2024, 11:23

Steven will take a look soon into it to check logs and see if there's an issue from Appwrite's side and your specific project

Florin Pop
15 Jul, 2024, 11:24

thank you

D5
15 Jul, 2024, 11:24

Maybe it's an issue with your network 🤔🤷‍♂️

D5
15 Jul, 2024, 11:24

No idea, sincerely 😅

Florin Pop
15 Jul, 2024, 11:24

well, I can chat with you here and all the other apps that are connected to the internet are working 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