Back

[SOLVED] How to setup realtime for web

  • 0
  • Web
  • Realtime
Berserker
7 Apr, 2023, 10:32
TL;DR
The user had a question about setting up realtime for web. They received assistance from another user. The issue was resolved by removing the unsubscribe function from the code.
Berserker
7 Apr, 2023, 10:32

@Arth now it appears bro

Arth
7 Apr, 2023, 10:32

lesgo

Arth
7 Apr, 2023, 10:32

how'd you fix it?

Berserker
7 Apr, 2023, 10:32

@Arth removed unsubcribe

Arth
7 Apr, 2023, 10:33

but there was no unsubscribe function called in the previous code

Arth
7 Apr, 2023, 10:33

and that shouldn't fix that

Berserker
7 Apr, 2023, 10:34

@Arth idk then :appwritepeepo:

Arth
7 Apr, 2023, 10:34

<:appwritepeepo:902865250427215882>

Berserker
7 Apr, 2023, 10:34

@Arth but thnx a lot for ur patience

Berserker
7 Apr, 2023, 10:35

@Arth bro what are events which are apparently returned by these subscribe methods ?

Arth
7 Apr, 2023, 10:35

you can find a list of them here https://appwrite.io/docs/events

Berserker
7 Apr, 2023, 10:35

@Arth gotcha

Berserker
7 Apr, 2023, 10:36

@Arth just know read through it

Berserker
7 Apr, 2023, 10:38

@Arth Realtime got disconnected. Reconnect will be attempted in 1 seconds. <empty string> eventhough this error is thrown , 101 status is maintained

Berserker
7 Apr, 2023, 10:38

@Arth

Arth
7 Apr, 2023, 10:39

show me the code and network tab

Berserker
7 Apr, 2023, 10:41

@Arth client.subscribe("account", (response) => { console.log(response); response.events; // Callback will be executed on account event. }); changed subscribe to account

Arth
7 Apr, 2023, 10:42

there seems to be no error

Berserker
7 Apr, 2023, 10:43

@Arth bro then lemme try to do something with this , then if some error is thrown i'll ping you up

Arth
7 Apr, 2023, 10:44

the subscribe method returns a function, which you can call to unsubscribe when you don't need it. Very important for SPAs, you should keep it in mind when changing components and pages

Berserker
7 Apr, 2023, 10:46

@Arth ok boss :appwritebow:

Tessa
7 Apr, 2023, 20:55

Thanks so much @Arth for assisting πŸ™‚

@Berserker is everything good so i can see if i need to close this? πŸ™‚

Berserker
8 Apr, 2023, 05:13

@Tessa i believe things are fine as of now

Tessa
8 Apr, 2023, 14:05

[SOLVED] How to setup realtime for web

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