Chat app backend idea/question?

Hey guys, i am trying to build a chat application in realtime, I already have a website with users which uses PHP/mysql (Codeigniter).

I want to enable my users to chat on an ionic app. My question here is that, should i use my own mysql server for saving chat messages or should i use another option? If any can you tell me with preferably a tutorial or guide.

I was also thinking about just sending the data to my website and everytime somebody sends a message i send the data to php,save it to db. Then the app would need to refresh in order to display messages and it wont be realtime i am guessing. But i am not sure if this would work super slow and cause delays on messages to show up.

(I have knowledge to do it with firebase but i do not want to pay so it is not an option for me)

How are you doing realtime on your website?

1 Like

I do not have a chat function on my website, I have a system where users have teams and they have functionalities. I am looking to make a chat app for users to be able to chat with their team members.

The simplest answer here is “Firebase.” Check the javebratt blog for some tips there. You could always roll your own if you’re willing/able to implement Observables. You need a way for the user to listen to a stream, and (the bigger issue) for updates to happen to the stream in a nondestructive way. What happens when both users are typing? When both post messages to each other at the same time? There are a lot more edge cases than there are for email.

1 Like

You can use node and to make a chat application and use mysql to save your messages. Don’t use Firebase, it is free but is very limited and if you need more from Firebase the prices are not too good for statups or small companies.


AaronSterling, thanks but as i said i do not want to pay for firebase as its free plan is pretty limited.

leonardoss, do you know any links/tutorials that can help me with this? The ones i found either made with ionic 1 or 2 and they dont mention the saving messages to mysql database part!

Thanks this is simple and can help, you will save your messages when you receive it on,

socket.on('message', function (msg) {
    console.log('Message Received: ', msg);
    socket.broadcast.emit('message', msg);
   // SAVE TO MYSQL with
1 Like

have you imjplemented the chat feature in you if yes can you please share som thing coz currently my requirement is same as of you connect group chat