Closed giorgio79 closed 4 years ago
The example project attached has 1 to 1 chat implemented. Similar architecture can be used for 1 to many chat.
Basically the SDK creates a group and any change in the messages document is notified to all the members. More then 2 members can be added to the group for 1 to many chat(Which is preferred to be done in firebase functions for security reasons).
I have plans to implement 1 to many chat with functions and the SDK would handle everything for you. But I am not sure about the timelines.
The security rules are subjective to the project and use case which is why I did not include it in the project. For me i had only made the messages document in the group public that too if the user is a member of the group and everything else was private and only to be modified by functions using the admin SDK. But well as i said it depends on the use case.
You are more then welcome to contribute to the project if you feel the project is useful.
Nice! Re table structure, another one to one chat flutter project uses userIds as message documents between two persons which seems quite efficient: https://pub.dev/packages/flutter_chat Someone even explained the logic behind it https://medium.com/@ngengesenior/database-structure-of-one-to-one-chat-app-with-firebase-93f813184dfe
Yes they do seem efficient and I checked them out before starting this project, I had something similar but with different use cases in mind for my idea, which were not being fulfilled by the mentioned library which is why i started this project.
As I said it all depends on the use cases right!🙂
Please provide Firebase sample integration for various scenarios, like 1 to 1 chat, 1 to many, many to many, with proposed database structure and Firebase cloudstore security rules.