Updated README

This commit is contained in:
Chris Boden 2012-01-08 23:39:23 -05:00
parent 8d1b2548e7
commit 32e9fe8c6c

View File

@ -1,13 +1,14 @@
#Ratchet
A PHP 5.3 (PSR-0 compliant) component library for serving/consuming sockets and building socket based applications.
Build up your application (like Lego!) through simple interfaces using the decorator and command patterns.
A PHP 5.3 (PSR-0 compliant) component library for serving sockets and building socket based applications.
Build up your application through simple interfaces using the decorator and command patterns.
Re-use your application without changing any of its code just by wrapping it in a different protocol.
Ratchet's primary intention is to be used as a WebSocket server.
##WebSockets
* Supports the HyBi-10 and Hixie76 protocol versions (at the same time)
* Tested on Chrome 13 - 15, Firefox 6 - 8, Safari 5, iOS 4.2, iOS 5
* Supports the RFC6455, HyBi-10, and Hixie76 protocol versions (at the same time)
* Tested on Chrome 13 - 16, Firefox 6 - 8, Safari 5, iOS 4.2, iOS 5
##Requirements
@ -16,8 +17,7 @@ To avoid proxy/firewall blockage it's recommended WebSockets are run on port 80,
Note that you can not run two applications (Apache and Ratchet) on the same port, thus the requirement for a separate machine.
Cookies from your domain will be passed to the socket server, allowing you to identify users.
It's recommended using a database/cache solution to store session data, so it's accessible on both web and socket servers.
A demonstration of this will be posted (eventually).
Accessing your website's session data in Ratchet is a feature in the works.
See https://github.com/cboden/socket-demos for some out-of-the-box working demos using Ratchet.
@ -28,6 +28,9 @@ In theory, the server (Apache/Nginx/ISS) would recognize the HTTP handshake requ
configured PHP file. When this happens, in theory, you can keep your script the same, just remove the Server Application wrapper and maybe eventually the
WebSocket Application wrapper if the servers recognize the protocol message framing.
I'm currently looking in using Nginx as an I/O control communicating with Ratchet (instead of Ratchet managing I/O).
I'm looking into a couple daemonized servers written in PHP to run Ratchet on top of.
---
###A quick server example
@ -45,6 +48,7 @@ use Ratchet\Resource\Command\Action\SendMessage;
use Ratchet\Resource\Command\Action\CloseConnection;
/**
* chat.php
* Send any incoming messages to all connected clients (except sender)
*/
class Chat implements ApplicationInterface {
@ -84,4 +88,6 @@ class Chat implements ApplicationInterface {
// Run the server application through the WebSocket protocol
$server = new Server(new WebSocket(new Chat));
$server->run(new Socket, '0.0.0.0', 80);
```
```
# php chat.php