Welcome to the CSC Q&A, on our server named in honor of Ada Lovelace. Write great code! Get help and give help!
It is our choices... that show what we truly are, far more than our abilities.


+15 votes

For our team project, my team wants to include a forum feature where students taking the same course can post questions and other things to a class-specific forum. We are using Cloud Firestore for our project and I was wondering if anyone had any suggestions on how to implement a forum-like feature using Cloud Firestore.

asked in CSC490_Spring202021 by (1 point)

2 Answers

+4 votes

You can incorporate this onSnapshot() listener to update the data you're displaying on the screen as other clients interact with your common database.
More information: https://firebase.google.com/docs/firestore/query-data/listen

Edit: In addition to this listener, you can create documents on firebase for each chat room, and continuously append messages to that document when the clients interact with the app

answered by (1 point)
+2 votes

Not sure if it'd work all that well, but maybe keeping all of the messages as a String object (saved on Firestore) and continually adding new messages to it. You could display the String in a scroll view and add in usernames and potentially time stamps. Might run into a storage issue, but it's just an idea.

answered by (1 point)