Skip to content
A simple PHP WebSocket implementation for PHP 5.3
Find file
Pull request Compare This branch is 148 commits behind nicokaiser:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

PHP WebSocket

Simple WebSocket server for PHP

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

Backward compatibility

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 with one Application that listens on ws://localhost:8000/demo:

// $interface, $port, $ssl
$server = new \WebSocket\Server(', 8000, false);

// Origin checking is supported

// As is basic rate limiting

$server->registerApplication('demo', \WebSocket\Application\DemoApplication::getInstance());


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.


  •, a Twitter API sample project.
Something went wrong with that request. Please try again.