Skip to main content
2 of 3
added 94 characters in body
jmosesman
  • 143
  • 1
  • 1
  • 4

How to build a turn-based multiplayer "real time" server

I want to build a TCG for mobile devices that is multiplayer over the web (not local wifi or bluetooth). As a player plays cards I want the second player to see what is being played in "real time" (within a few seconds). Only one player can play at a time.

Server requirements:

  1. Continuously listens for input from Player 1
  2. As it receives input from Player 1, sends the message to Player 2

I know some PHP, but it seems like unless I had a loop that continued until I broke it (seems like a bad idea) the script would just receive one input and quit.

On the mobile side I know I can open sockets using various frameworks, but what language allows a "stream-like" behavior that continuously listens/sends messages on the server?

Or if I'm missing something, what would be the best practice here?


EDIT: I might have not made it clear before, but the mobile apps are native not web-based.

jmosesman
  • 143
  • 1
  • 1
  • 4