I am trying to build a chat app using android, firebase, php and MySQL but I can't afford to store all the messages on firebase database yet. So, I like to use it just for real time chatting while two users are interacting each other and then delete all the chat log on the firebase and store it on my own database, so that I can show the messages from the previous conversations to the users.
So the problem is that how will I be able to show the previous messages to the user. Here are the logic I can figure out
1) I will upload all the old messages to the firebase database when two users start to interact each other and show all the old and new conversation in the recyclerview android.
But this could become trouble when thousands of users start to interact each other at the same time as we need to upload bulk amount of data to the firebase.
2) Get all the old conversations from my own server and create new node on firebase database then show all of them together again in a recycler view.
But it will be very painful to show the old and new messages in a single recyclerview from two different data sources and can't do realtime sync.
Is there any possible way I could have done and I would be much appreciated if you guys started discussing about this topic.
P.S : I will use firebase pay service later when I can afford.