Back

[SOLVED] realtime calls the function multiple times when detected change

  • 0
  • Web
  • Realtime
Drake
28 Dec, 2023, 07:39

It doesn't matter what file it's in...it can still happen multiple times

TL;DR
The user had an issue with a realtime function being called multiple times when a change was detected. In the support thread, they received help and were able to solve the problem by getting the change from the payload rather than calling the function. The user also asked about putting an unsubscribe call inside the function, but it was advised against as there would be no callbacks after unsubscribing. The user then asked if there was a way to re-subscribe when there's a change, but it was suggested that they may be subscribing multiple times without unsubscribing. The conversation continued with discussions about the number of callbacks received and how to handle them.
RangerDev πŸ”»πŸ”»πŸ”»πŸ”»
28 Dec, 2023, 07:40

Oh alright

RangerDev πŸ”»πŸ”»πŸ”»πŸ”»
28 Dec, 2023, 07:40

What seems to be the issue?

RangerDev πŸ”»πŸ”»πŸ”»πŸ”»
28 Dec, 2023, 07:40

Its my first time ever doing realtime sorry

Drake
28 Dec, 2023, 07:41

I don't know. Like I said, you may be calling subscribe multiple times

RangerDev πŸ”»πŸ”»πŸ”»πŸ”»
28 Dec, 2023, 07:41

I've tried unsubscribing but then after I unsubscribe I do not get callbacks

Drake
28 Dec, 2023, 07:41

So how many of these come through and are the events the same?

RangerDev πŸ”»πŸ”»πŸ”»πŸ”»
28 Dec, 2023, 07:41

No it increases each time

RangerDev πŸ”»πŸ”»πŸ”»πŸ”»
28 Dec, 2023, 07:42

The amount went from 16 to 23 (I just counted)

RangerDev πŸ”»πŸ”»πŸ”»πŸ”»
28 Dec, 2023, 07:44

The event are the same it's the callback that gets called

Drake
28 Dec, 2023, 07:46

What amount?

RangerDev πŸ”»πŸ”»πŸ”»πŸ”»
28 Dec, 2023, 07:46

The callbacks

Drake
28 Dec, 2023, 07:46

Definitely sounds like you're subscribing multiple times without unsubscribing

RangerDev πŸ”»πŸ”»πŸ”»πŸ”»
28 Dec, 2023, 07:47

^

RangerDev πŸ”»πŸ”»πŸ”»πŸ”»
28 Dec, 2023, 07:47

Is there a way to re subscribe when there's a change?

Drake
28 Dec, 2023, 07:47

No, that's not the solution

RangerDev πŸ”»πŸ”»πŸ”»πŸ”»
28 Dec, 2023, 07:48

Hmm

RangerDev πŸ”»πŸ”»πŸ”»πŸ”»
28 Dec, 2023, 07:48

What do I do?

RangerDev πŸ”»πŸ”»πŸ”»πŸ”»
28 Dec, 2023, 07:48

Because after unsubscribing you get no callbacks

RangerDev πŸ”»πŸ”»πŸ”»πŸ”»
28 Dec, 2023, 07:49

And you can't re subscribe either

RangerDev πŸ”»πŸ”»πŸ”»πŸ”»
28 Dec, 2023, 15:44

Do I put an unsubscribe call inside the function

RangerDev πŸ”»πŸ”»πŸ”»πŸ”»
28 Dec, 2023, 15:44

?

Drake
28 Dec, 2023, 20:38

sorry, i don't know. it depends on your logic

RangerDev πŸ”»πŸ”»πŸ”»πŸ”»
29 Dec, 2023, 02:08

Thanks for ur help during the Office Hours I managed to solve the issue. I jsut got the change from the Payload and did it that way rather than calling the function.

RangerDev πŸ”»πŸ”»πŸ”»πŸ”»
29 Dec, 2023, 02:11

[SOLVED] realtime calls the function multiple times when detected change

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