Best way to model a chat database

Asked

Viewed 1,198 times

5

I have an application that works with webservices and mysql database, I’m putting a chat in it, the part about how to pick up messages, display notifications and search for users I already have, my question is:

How I should store messages in the bank?

I’ve thought of some ways, but I don’t find it interesting. The first was, I would create a message table in my bank and it would have a sender, recipient and the message, but I don’t think it’s interesting, because messages can take up a lot of space in my bank. The second was, I would not use my external bank, but Sqlite, in it I would save the history of conversations, so each user would have only his messages in his bank. But I can’t do that, because if my user logs into their account on another device, the messages wouldn’t be there.

  • Maybe a full storage on the device and keep in the cloud only the last 10 or 20 messages...

  • But why not want to store in Mysql? I didn’t understand that.

1 answer

-1

Another solution would be to use Dropbox. If the user wanted to have message history, they could log in through Dropbox and then you would have access to save files to their account through the Dropbox API. Therefore, you would not occupy space in your database :D

Browser other questions tagged

You are not signed in. Login or sign up in order to post.