Version: 1.0.0
A simple websocket server for PHP 5.3, using streams.
- Supports websocket draft hybi-10,13 (Currently tested with Chrome 18 and Firefox 11).
- Supports origin-check.
- Supports various security/performance settings.
- Supports binary frames. (Currently receive only)
- Supports wss. (Needs valid certificate in Firefox.)
The public API of the server should remain compatible with early versions of
php-websocket. The WebSocket namespace begins in the /server/lib
directory.
The client-side libraries are deprecated and may be removed in future: the
exist as an example. You're free to use whatever client-side libraries you'd
like with the server.
The library is PSR-0 compatible, with a vendor name of WebSocket (note the capital S). An SplClassLoader is bundled for convenience.
This creates a server on 127.0.0.1:8000 with one Application that listens on
ws://localhost:8000/demo
:
// $interface, $port, $ssl
$server = new \WebSocket\Server(127.0.0.1', 8000, false);
// Origin checking is supported
$server->setCheckOrigin(true);
$server->setAllowedOrigin('example.org')
// As is basic rate limiting
$server->setMaxClients(100);
$server->setMaxConnectionsPerIp(20);
$server->setMaxRequestsPerMinute(1000);
$server->registerApplication('demo', \WebSocket\Application\DemoApplication::getInstance());
$server->run();
The original maintainer and author was @nicokaiser. Plentiful improvements were contributed by @lemmingzshadow and @mazhack. The server is licensed under the WTFPL, a free software compatible license.
- Add support for fragmented frames.
- To report issues, see the issue tracker.
- Jitt.li, a Twitter API sample project.