I’m facing the challenge of building a live chat server for use in a mobile app. It is an interesting bit of code to write and I’m finding myself learning a few new things to get it working.
My first thought was to build it using websockets over HTTP but that looked too difficult to build on both the server side and client side.
On the server side there you need to have a different kind of server. The standard Apache web server is just not going to cut it if there are 1000+ people in a realtime chat. It’s necessary to change things over to a service such as Node.js or a Python Twisted server.
The overhead of websockets on the client side was also too high and it appears that JSON over straight sockets is the way to go.
From a design perspective there is the issue of room size. If there are too many people talking at once it becomes difficult to follow any sort of conversation, and with too few people the community will feel dead and unresponsive. It’s important to separate people out into ‘rooms’ to avoid too much noise while not spreading them too thin so that there’s no one to talk to. It will be an interesting challenge to try and find the right balance to this.
I’m hoping to have something functioning by next weekend.