Help with firebase and chat

hello people,
i am working on a chat for my app and it worked now with the Chatview and firebase but i have a problem firebase store only the last msg what was sent. so if i log in the chat i get only the last msg and not ,more. how can i safe the data in firebase that i get more as the last msg. The last 10 or so will be good or the last 100. I looked all videos with firebase and chat but i dont find a solution


this is how it works that i get the msgs in the chatview and safe the msg into firebase.

1 Like

I think it’s because your adding the new messages over the old ones. When you add new message(Store data) you have to add also the previous ones(store data). I think that’s why.

The point is that firebase stores a value for each label. If you want to store a conversation I think you could create tags per message. And make a way for each label to be named with a variable adding a number (For example conversation+1…)
To have a better order, you could put a project bucket with the date (for example) and inside that project bucket store the conversation. That way you can retrieve (with GetTagList ) all the conversations of a given day.

For the conversation you could organize firebase something like:

firebase%20chat

Or you could also use the same structure of date and name and store all the conversation of each one in the label with his name. Something like: John-messages=blabla, blabla, blabla, blabla, blabla

2 Likes

As you already know and I guess have figured out here’s the answer for this question :slight_smile:

Then you can store how many msg you want, 1, 5, 10, 100, 1000 etc…

1 Like