Which architecture is good for my mobile Chat app in this situation?

I am developing an android app connecting to django backend. My django server in AWS already has own mysql database. (firebase is used for sns authentication) Now I have to add chat functions to this app. It includes group chatting but probably many users may use 1:1 chatting.

My question is which architecture is good for mobile Chat app? Options I am thinking now ..

  1. Chat messages are stored in mysql database in AWS, and server notify message by only using FCM(Firebase cloud messaging). All text, image or voice urls would be in payload for FCM. A user can only log in on one device at a time. (If this option has no critical performance issue, I think it is a simple way, because I already have backend with database, and I don’t need to care whether user’s Mobile App is in foreground or background. If App needs to show messages when chatting room(channel) is mounted on screed, otherwise just uses notification tray)
  2. Use Firebase Realtime database only for chatting functions. It is real time, but I need to create an additional DB in Firebase, and I am not sure how to handle message when app is in background.
  3. Chat messages are stored in mysql database in AWS. And when App shows a chat room on the screen, It makes a socket connection with backend server. Server handles connections and determines how to deliver messages (socket or FCM push notification according to app status of receiver)
  4. or a better option?
Back to Top