Send Messages Instantly
I'm trying to send messages back to the client instantly, but I believe Ratchet / React sends everything at once.  This means, for example, if I would like to send a message every second, all the messages reach the client at the same time, rather than one after the other.

I found an example of how to use nextTick to overcome this, but I can't seem to get it to work - it still just dumps everything to client at once, rather than receiving 0, then a second later; 1, then 2, 3, 4.

Could someone please point out what I'm doing wrong.  Thank you!

``` php
    require __DIR__ . '/vendor/autoload.php';

    class LoopMessages implements \Ratchet\MessageComponentInterface {

        private $loop;

        public function __construct(\React\EventLoop\LoopInterface $loop) {
            $this->loop = $loop;
        }

        public function onOpen(\Ratchet\ConnectionInterface $conn) {
            echo "New connection! ({$conn->resourceId})\n";
        }

        public function onMessage(\Ratchet\ConnectionInterface $conn, $msg) {

            for($i = 0; $i < 5; $i ++) {

                $this->loop->nextTick(function() use ($conn, $i) {
                    echo $i."\n";
                    $conn->send($i);
                    sleep(1);
                });

            }

        }

        public function onClose(\Ratchet\ConnectionInterface $conn) {
            echo "Connection {$conn->resourceId} has disconnected\n";
        }

        public function onError(\Ratchet\ConnectionInterface $conn, \Exception $e) {
            echo "An error has occurred: {$e->getMessage()}\n";
        }

    }

    $loop = \React\EventLoop\Factory::create();

    $socket = new \React\Socket\Server($loop);
    $socket->listen(8080, '0.0.0.0');

    $server = new \Ratchet\Server\IoServer(
        new \Ratchet\Http\HttpServer(
            new \Ratchet\WebSocket\WsServer(
                new LoopMessages($loop)
            )
        ),
        $socket,
        $loop
    );

    $server->run();
```
