I need help in building web based real time chat application using firestore database. In website, I need list of users at left side who recently chatted and at right side, I need particular user chat conversation window. And I want to update left side user list with recent message whenever any of that user send or receive message. I do have firestore collection and its sub collection structure as explained below
ChatRooms (collection)
ChatRoom1 (document)
Messages (collection)
Message1_1 (document)
Message1_2 (document)
ChatRoom2 (document)
Messages (collection)
Message2_1 (document)
Message2_2 (document)
Now here, on my ChatRooms collection's onSnapShot event, I want to trigger snapshot if new message document is added in "Messages" collection. As I can get trigger when there is new document in "ChatRooms" collection but I am not able to get it from "Messages" collection which is actually sub collection. Will appreciate your help.
Aucun commentaire:
Enregistrer un commentaire