HTML5 php websocket

Dhinesh.B picture Dhinesh.B · Mar 11, 2013 · Viewed 8.5k times · Source

I'm new to HTML 5, websocket. We are trying application like white board.Users who all are logged in that particular session can type their thoughts in white board div. It should display to all users who are logged in that session. So i tried to use Php Websocket. what all are the steps need to follow to run php Websocket on server side. Let me know further clarification.

Thanks, Dhinesh.B

Answer

devnull69 picture devnull69 · Mar 11, 2013

Find some PHP classes that implement the latest Websocket protocol RFC6455. This is an example implementation that I tested and that is working just fine: https://github.com/esromneb/phpwebsocket . Copy those files to your websocket subfolder (e.g. /websocket)

The steps are:

  1. Run the server side PHP (e.g. php -q websocket.demo.php). Use a previously unused socket port.
  2. Connect to the server using a client HTML with Javascript websocket code. In your Javascript code use the port that you specified for the server (e.g. localhost/websocket/client.html)