Build a realtime chat app which stores messages in a MySQL database

by ThatOneQuestionn   Last Updated January 13, 2018 04:05 AM

I'm thinking of making a realtime chat app that would allow me to store user messages into a MySQL database. So far these are the two ideas I have.

1) Create and API which the message is sent to and then saved in the database. After the message is saved into the database a push notification is sent to the person who is to receive the message and then a script is run in the background to download the message from the database.

2) Use websockets or XMPP to allow messages to be sent and received by the sever and just save the message to the MySQL database when it reaches the server.

Which one of these methods would be best to implement and scale for a realtime chat application. Method one seems pretty good but I'm not sure if constant SQL transactions are good for a server, the payload might be too much.



Related Questions


Android-Socket.io design pattern

Updated March 25, 2017 12:05 PM




How to design a web app showing real time logins

Updated September 06, 2017 01:05 AM