An open API service indexing awesome lists of open source software.

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

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 :)