Go to file
Chris Boden 1c0b8ed32d Restructure Overhaul
Server accepts single Observable object (was Chain of Responsibility)
WebSocket is decorator of application implementing Observable
Observable interface returns Command pattern object
Interfaced all the things
Code is a mess
Unit tests are broken
2011-10-27 18:36:29 -04:00
lib/Ratchet Restructure Overhaul 2011-10-27 18:36:29 -04:00
tests Unit Testing 2011-10-24 14:05:54 -04:00
.gitignore Fixed Socket bugs from Unit Testing 2011-09-06 14:30:14 -04:00
phpunit.xml.dist Stubs, coverage, api docs 2011-09-05 08:53:21 -04:00
README.md Updated README 2011-09-06 08:49:04 -04:00

#Ratchet

A PHP 5.3 (PSR-0 compliant) application for serving and consuming sockets.


##WebSocket

Ratchet (so far) includes an "application" (in development) to handle the WebSocket protocol.


###A Quick server example

<?php
    namespace Me;

    class MyApp implements \Ratchet\ReceiverInterface {
        public function getName() {
            return 'my_app';
        }

        public function handleConnect() {
        }

        public function handleMessage() {
        }

        public function handleClose() {
        }
    }

        $protocol    = new \Ratchet\Protocol\WebSocket();
        $application = new MyApp();
        $server      = new \Ratchet\Server(\Ratchet\Socket::createFromConfig($protocol));

        $server->attatchReceiver($protocol);
        $server->attatchReceiver($application);

        $server->run();