Skip to content

obeid-s/php_socket

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Server socket with php

Simple php socket [Server] for webSocket HTML5

Edit /js

don't forget to edit main.js file with ws://YOUR_DOMAIN:PORT/

Edit /main.php

$socket = new ServerSocket(SAME_DOMAIN_IN_JS, SAME_PORT);

Run main.php

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.

important

don't forget to enable the php extenstion [socket].

About

php server socket & HTML 5 WebSocket

Resources

Stars

Watchers

Forks

Packages

No packages published