Go to file
Chris Boden 3127efc981 Cleanup
Removed redundant Interfaces
Removed a number of unused methods
2011-11-01 09:52:41 -04:00
lib/Ratchet Cleanup 2011-11-01 09:52:41 -04:00
tests Cleanup 2011-11-01 09:52:41 -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 Readme 2011-10-28 14:20:25 -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;
    use Ratchet\Socket;
    use Ratchet\SocketInterface as Sock;
    use Ratchet\Server;
    use Ratchet\Protocol\WebSocket;

    class MyApp implements \Ratchet\ReceiverInterface {
        protected $_server;

        public function getName() {
            return 'my_app';
        }

        public function setUp(Server $server) {
            $this->_server = $server;
        }

        public function onOpen(Sock $conn) {
        }

        public function onRecv(Sock $from, $msg) {
        }

        public function onClose(Sock $conn) {
        }
    }

    $server = new Server(new Socket, new WebSocket(new MyApp));
    $server->run('0.0.0.0', 80);