views:

187

answers:

1

I want to build a question/answer game with rooms and chat. My question is: Is it possible to make it with just php and http requests? From you're experience, how many visitors will it hold. I know it's better with socket server but i only have a shared host rith now.

+2  A: 

Sure it's possible with only PHP+HTTP. You'd have to have a poller running on a setInterval to keep asking the server via XMLHttpRequest if there are new lines of chat or game moves, though. How many users you can support depends on how quick that update time must be; if users can wait many seconds between polls you won't have a problem, but if they need split-second updates that's a lot of polling and your shared server won't be sufficient at all.

For any realtime responsive chat or action games you would need your own ‘socket server’ type of arrangement, using ‘Comet’-style long-polling techniques, Flash sockets or, in the future, HTML5's much more convenient WebSocket.

(I'd look at virtual dedicated servers anyway; they're cheap these days and sharing a server for PHP scripts puts you at the mercy of other users for performance and security.)

bobince