Jump to content

Recommended Posts

Hello,

 

Would you recommend WebSockets, SOAP, or some other transmission architecture for the following?

 

I'm developing an online multiplayer (or single player vs the system) game, kind of like "Jeopardy!" in PHP. Users will log on, and if they choose to play against someone else in a different location, then the game will have to know who buzzed in first (clicked on a button on the screen) and instantly notify both players. The game will tell the first player that they buzzed in first, and the other player will instantly know that they they buzzed in after the first person and therefore can't answer. There could be X number of games simultaneously, but each game would have only 1-2 players.

 

Questions would be stored in a MySQL db, as well as player credentials and score histories. Transmission from the server to the client and back would need to be encrypted.

 

Thanks!

Link to comment
https://forums.phpfreaks.com/topic/236016-websockets-or-soap-or-which-to-choose/
Share on other sites

Client-side? Yeah, WebSockets. Or Flash/Java until there's enough browser support for WebSockets (almost there!).

 

For PHP you'd pair it with standard sockets - fsockopen and the like, as opposed to regular HTTP (ie, invoking PHP scripts like normal) and SOAP and other protocols which add a lot of overhead.

PHP is not the greatest at running for a long time. It works best for short-term usage. I think your Jeopardy game thing will be short enough to not be an issue: for now you can spawn a new PHP script for each game running, which terminates when the game is over. So no, for now you don't need more than a LAMP stack.

 

You don't need to worry about switching ports - the OS will handle that work for you. You have whatever listen on a certain port, and when a connection is made, if accepted the connections will go elsewhere, thus freeing up the original port for more traffic.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.