Simple php socket [Server] for webSocket HTML5
don't forget to edit main.js file with ws://YOUR_DOMAIN:PORT/
$socket = new ServerSocket(SAME_DOMAIN_IN_JS, SAME_PORT);
open your terminal and go to the folder and type php .\main.php
,
you should see in the terminal:
------ Server running DOMAIN:PORT ------
----- Waitting for client to connect 1/2 ----
open your browser http://DOMAIN and the client should connect to the server [Client 1].
open a second tab (or new window browser) and type the same url, the client should connect [Client 2].
in the browser you should see (Socket is open) in both tabs [Client 1, Client 2].
Start sending and reciving the messages between the clients.
don't forget to enable the php extenstion [socket].