Chat Screen Approach

Hello,

I am during build of app in which users can talk with each other (lets’ say like FB Messenger), so really important for me is realtime chat. I am using Google Firebase as backend, and Firestore as DB. As I assume Appgyver does not support for now channel subscription to always update our data variable to latest state with latest data from Firestore?

If not, I assume that this will cause a lot of DB reads as always when we send message it should look like below as we always after sending message need to fetch new data:
image

That wont be a problem with a lot of messages sended daily?

Also, we cannot know when user on the other side send message, so we cannot refresh channel on other side what makes impossible to do a realtime chat? How do you approach this things?

Not something I know much about… But as far as I understand. the delay in getting data is pretty much what determines the “real-time” aspect of it. And by default it should be about five seconds.

That said: Firebase tends to charge after a specific number of reads/writes… So you may want to plan this forehand in case you surpass the free account limitations.

@Berter_Akyol, 5 sec is standard flow made by AppGyver team for API requests.

Google Firebase support listeners for realtime updates, and its a part of Firestore: Obtén actualizaciones en tiempo real con Cloud Firestore

As AppGyver have direct integration with GF I was thinking that for realtime updates too :confused:

@Mevi or @Harri_Sarsa, maybe do you have some info about this?

Hi,

we don’t support the real-time connectors as of now I’m afraid, so you’ll have some lag inevitably. You can modify the standard flow to refresh more often, but be careful with that. At least make the logic so that you don’t set the data variable anew unless there was a change, as you will run into performance issues (although if you refresh very often, you will likely run into performance issues regardless, so keeping some delay is advisable).

1 Like