What would be the best way to add chat feature to an android, ios, and web app? Is polling really as bad as people say?
The requirements are user to user messaging and chat rooms.
Here is my thought process:
- Long polling with in memory cache. The long polling endpoint will continually check the in memory cache. Pretty simple to implement.
- XMPP based server like OpenFire. Hard to horizontally scale. Some other implementations scale well but setup is more complex.
- Websocket with in memory cache. Pretty simple to implement.
- Short polling with reasonable delay, say every two seconds to ping the server. Query relational database. Store all chats in database. Have it designed so that if user doesn't do anything after 20 seconds, they get a prompt or we stop polling. This seems the simplest to implement.
I guess what I'm wondering is short polling really that bad. I am making a startup and don't want to make a mistake with investing time with a solution that isn't going to scale well.
At the same time, I am thinking that if I get funding / traction, then I can always invest into the more scalable solution.
If I don't make any money from it though, I don't want to invest time into the app.