Download the PHP package mpociot/phpws without Composer
On this page you can find all versions of the php package mpociot/phpws. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download mpociot/phpws
More information about mpociot/phpws
Files in mpociot/phpws
Informations about the package phpws
WebSocket Server and Client library for PHP. Works with the latest HyBi specifications, as well the older Hixie #76 specification used by older Chrome versions and some Flash fallback solutions.
This project was started to bring more interactive features to http://www.u2start.com/
Features
Server
- Hixie #76 and Hybi #12 protocol versions
- Flash client support (also serves XML policy file on the same port)
- See https://github.com/gimite/web-socket-js for a compatible Flash Client
- Native Firefox, Safari (iPod / iPhone as well), Chrome and IE10 support. With Flash Client every browser supporting Flash works as well (including IE6-9, Opera, Android and other older desktop browsers).
- Opera (Mobile) supports WebSockets natively but support has been disabled by default. Can be enabled in opera:config.
Client
- Hybi / Hixie76 support.
- Event-based Async I/O
Getting started
The easiest way to set up PHPWS is by using it as Composer dependency. Add the following to your composer.json
And run
To verify it is working create a time.php in your project root
And a client time.html as follows
Now run the time.php from the command line and open time.html in your browser. You should see the current time, broadcasted by phpws at regular intervals. If this works you might be interested in more complicated servers in the examples folder.
Getting started with the Phpws Client
The following is a client for the websocket server hosted at http://echo.websocket.org
Known Issues
- Lacks ORIGIN checking (can be implemented manually in onConnect using getHeaders(), just disconnect the user when you dont like the Origin header)
- No support for extension data from the HyBi specs.
Requirements
Server
- PHP 5.4
- Open port for the server
- PHP OpenSSL module to run a server over a encrypted connection
- http://pecl.php.net/package/pecl_http as its a dependency of Zend\Uri
-
Composer dependencies * These will be installed automatically when using phpws as a composer package.
- Reactphp
- ZF2 Logger
Client
- PHP 5.4
- Server that implements the HyBi (#8-#12) draft version
- PHP OpenSSL module to connect using SSL (wss:// uris)
All versions of phpws with dependencies
react/socket Version ^1.0 || ^0.8.6
react/stream Version ^1.0 || ^0.7.5
zendframework/zend-http Version 2.*