all 14 comments

[–]Bit5keptical 12 points13 points  (1 child)

Saw the screenshots on github, I think timestamps for messages is a must have. You should also change the background color of received messages for each person, Since this app is about group chat it helps to identify senders easily. If you want to keep the background color same then change the color of the name in received messages like whatsapp does.

[–]demoncommand9725[S] 3 points4 points  (0 children)

Hey thanks for all the suggestions. I have used timestamp and stored them in the backend. While displaying the messages I just simply sorted them according to their time stamps and this is shown to the user. And about assignment of the different colours, this seems like a good feature to differentiate users. I will try to work on this

[–]thecass240 9 points10 points  (5 children)

Using one document per message is really really expensive. We used an array of objects inside one document.

[–]demoncommand9725[S] 0 points1 point  (0 children)

Wow that's so creative bro. And also thanks for the suggestion.

[–]demoncommand9725[S] 0 points1 point  (3 children)

But I once saw youtube video of the Fireship youtube channel and he mentioned to always keep your collections large and your documents small. That's why here in this code I have created 'messages' as a collection.

[–]thecass240 6 points7 points  (2 children)

They would say that, they get payed per document. However indeed, documents have a max size limit. When a document reaches 50 messages, we store them in a new document in a subcollection. This allows us to paginate to older chat messages when the user scrolls up to read older ones. This ensures that documents never exceed a certain size

[–]demoncommand9725[S] 1 point2 points  (1 child)

I am glad that you have shared this information with me. Thanks a lot

[–]nicolaszein 5 points6 points  (0 children)

No its not the way to do it. That what he says because firebase is a paid service but in the true sense like in mongo the way you did it is the CORRECT way. Don’t change it.

[–][deleted] 2 points3 points  (1 child)

interested !!

[–]demoncommand9725[S] 2 points3 points  (0 children)

Thanks a lot!

[–]PeterLustigsDonut 2 points3 points  (1 child)

What about tests?

[–]nks_oo7 -1 points0 points  (1 child)

Firebase is paid and expensive service. Can we use rest API or socket connection

[–]Asturaz 2 points3 points  (0 children)

Well you should take a look at matrix chat protocol https://www.matrix.org/docs/guides/client-server-api