Back

multiple instances of RealTime data

  • 1
  • Databases
  • Flutter
  • Realtime
Nuaiman
23 Jun, 2023, 18:30

Hello, in my app, which is a twitter clone, what I do is I post a tweet and also I listen to realtime to get my latest tweet inside of my app feeds.

I setup the real time using riverpod's streamProvider and I use ref.watch to listen to it. So, when I post a tweet I get multiple instances of my tweet but when I restart the app everything is okay, only one instance of the tweet is shown.

TL;DR
The user is experiencing an issue with their app where they are getting multiple instances of a tweet when using realtime subscription. They mention a solution of checking if the tweet was added earlier before adding it again and refer to a bug with realtime and subscribing multiple times. Restarting the app resolves the issue temporarily. They are using riverpod's streamProvider and ref.watch to listen to the realtime stream.
Drake
23 Jun, 2023, 18:36

There's a bug with realtime and subscribing multiple times: https://github.com/appwrite/sdk-for-flutter/issues/156

As a reminder, please make sure to search previous <#1072905050399191082> posts before posting.

Nuaiman
23 Jun, 2023, 18:37

Thankyou, sure I will.

Hassanmrwt
25 Jun, 2023, 07:46

There is a solution to,to prior adding new tweet to old tweets, first check if it was added earlier from previous realtime subscription. As of my expeirence we get four events when we subscribe to realtime, and as a result Document (Tweet in your case) is added multiple times to List (Builder).

Hassanmrwt
25 Jun, 2023, 07:50

You can clear your concept from this snippet

Nuaiman
25 Jun, 2023, 08:22

Thankyou @Hassanmrwt , I will check it out soon πŸ™‚

Hassanmrwt
25 Jun, 2023, 08:22
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