https://github.com/firehed/websockets-server
PHP-based server for html5 websockets
https://github.com/firehed/websockets-server
Last synced: about 1 year ago
JSON representation
PHP-based server for html5 websockets
- Host: GitHub
- URL: https://github.com/firehed/websockets-server
- Owner: Firehed
- Created: 2010-08-06T05:20:08.000Z (almost 16 years ago)
- Default Branch: master
- Last Pushed: 2011-10-27T22:27:29.000Z (over 14 years ago)
- Last Synced: 2025-02-13T22:26:59.334Z (over 1 year ago)
- Language: PHP
- Homepage:
- Size: 105 KB
- Stars: 4
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README
Awesome Lists containing this project
README
The client can connect to the server with javascript like the following:
var host = "ws://127.0.0.1:9000";
try {
socket = new WebSocket(host);
socket.onopen = function(msg){ console.log("Connected"); };
socket.onmessage = function(msg){ console.log(msg.data); };
socket.onclose = function(msg){ console.log("Disconnected"); };
}
catch(ex){ console.log(ex); }
Use socket.send('string'); to push data to the server. Look in ./app/Action.php to
handle the input the client sends. You could use some sort of auth system on the
first connection to tie a Client to your web app's users. Find something useful that
you can do with that knowledge :)