I'm just doing a bit of research into tech to use for a mobile multi-player game.

It's more an experiment at present so for the moment, the only thing that Players need to be aware of is the other Players.

If this was a typical web application and not a game It'd just have HTTP requests firing all the time -- but since this is a game, performance and accuracy is going to be a problem.

Due to the game being targeted at multiple phone platforms, lets say that the client will be written in JavaScript or a framework based on JavaScript. The server technology is totally open.

Each player will need to make the equivalent of a HTTP post and get only using a faster protocol. The reason for multiplayer being web based is because multiplayer across Bluetooth or other local networking would be too diverse across the platforms and could cause problems.

So the question boils down to whats a good protocol/technology to use for JavaScript multiplayer? Any advice on the server side stuff or does it matter? Any reason I should drop this two-tier architecture and go with direct phone-to-phone connection?


3 Answers 3


You want a better communication protocol then HTTP. You probably want UDP or TCP. Browsers have no way of doing UDP communication so your only choice is TCP.

For TCP you would want to use a WebSocket, however browser support is unstable on websockets.

This means you would need to use a COMET technique to emulate TCP, one popular emulation would be a websocket embedded in a flash application.

Socket.IO is a library (for node.js) that supports websockets and emulates them with an appropiate fallback on non compliant web browsers (it uses flash and other COMET techniques).

For multiplayer JavaScript games I would recommend the usage of socket.io and node.js

  • 1
    \$\begingroup\$ Here's a sample of a real-time game made with HTML5 & WebSockets: rawkets.com. The source code is available here: github.com/robhawkes/rawkets \$\endgroup\$
    – Elisée
    Oct 10, 2011 at 13:45
  • 1
    \$\begingroup\$ Here are two more examples \$\endgroup\$
    – Raynos
    Oct 10, 2011 at 13:56

Both the question and the accepted answer were published in 2011, and the times have quite changed since :)

Websockets is quite prevalent, but an even better technology is WebRTC which allows for unreliable UDP streams. These are much, much better for games.

Other than communication, there are many other obstacles to overcome when writing multiplayer games such as game state reconciliation, client-side prediction, serialization and many others.

<shameless self promotion>

I'm one of the original developers of lance.gg, a multiplayer game server/library based on node.js where we've solved many of the problems mentioned (and many others!). Our goal is to make multiplayer game development easier for JavasScript game developers. I warmly invite you to use it as a starting point for making your game.

</shameless self promotion>


Check this:


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .