Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to start developing a browser game. Not for success, just for the sake of doing it and learning something from it.

Now, a point where I have serious problems figuring out how to deal with it is; how does one player receive message of another player does something that is somehow time-critical.

Easy example for a trading card game; Player 1 plays The devious flames of hell and Player 2 has to react to this card by playing Watery waves directly afterwards, before the card of Player 1 takes effect (so to say a counter-card).

Of course, I could just request the server every second and see if the other player did something, but I was hoping for a less request-frequent solution, like the server pushes the event of Player 1 playing a card to Player 2.

share|improve this question
possible duplicate of Lightwight cross browser library for server side push? – bummzack May 17 '11 at 9:49
up vote 3 down vote accepted

I just stumbled on this the other day -- check out NowJS at as I think it will give you a nice solution.

From the site...

NowJS creates a magic namespace "now", accessible by server and client. Functions and variables added to now are automatically synced, in real-time. Call client functions from the server and server functions from client

share|improve this answer
Nice find. I wasn't even aware of Socket.IO. – CiscoIPPhone Jul 29 '11 at 11:56
Is that limited to the amount of simultaneous connections you can have at once? – OpensaurusRex Oct 26 '12 at 11:24

You can also use long polling in HTTP with Redis, if you want to reduce the pulling on the server. The script essentially "listens" for the "broadcast" from your script.

share|improve this answer

"somehow time-critical" as in low latency?

WebSocket is the only way

share|improve this answer

Try APE project

It's great for low-latency server pushing

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.