Web server talking to multiple persistent processes
I will first describe the functionality I want to achieve, then what I think my technical problems are.
Functionality: I want to create an HTML/JavaScript client for the IGS (Internet Go Server). It's similar to FICS (Free Internet Chess Server) in that playing is done via telnet, and all graphical clients are just wrappers around that original protocol. My goal is to be able to play without any additions to the web browser (no Java, Flash, etc.).
Technical issues: the biggest issue I see is server-side. In order to start a game, the web server has to open a persistent socket to the IGS, and use it to both send and receive data. (And every player will need a new such connection.) This is quite different from the CGI mindset used in web development.
One solution I thought of is the web server forking a process for each player that will manage the socke开发者_开发问答t and talk to the web server via a DB. This doesn't sound very appealing (indirection, polling, ugh...). Hence my question: what is the standard solution to such a problem?
Check out Socket.IO (java version) for sending messages between a client and server over http. You would need some sort of message bus to communicate moves between clients.
精彩评论