WebSockets с Ratchet

Доброго времени суток. Нужна помощь по Ratchet. Дело в том, что делаю всё по официальному мануалу, но при выполнении $server->run(); экшн просто зависает. Подключил через Composer, на некорректные пути не ругается. Код SiteController с ошибкой




//Сверху в SiteController добавил все use-директивы

use Ratchet\Server\IoServer;

use Ratchet\MessageComponentInterface;

use Ratchet\ConnectionInterface;

use Ratchet\Http\HttpServer;

use Ratchet\WebSocket\WsServer;


//Непосредственно экшн


public function actionTest()

	{

		//$ratchet = new MyRatchet();

		//var_dump($ratchet); //Создается, все нормально

		

		$server = IoServer::factory(

        new HttpServer(

            new WsServer(

                new MyRatchet()

            )

        ),

        8080

    );

		//var_dump($server);

		

		$server->run(); //Зависание тут!

		$this->render('test');

	}

Модель MyRatchet


<?php


use Ratchet\MessageComponentInterface;

use Ratchet\ConnectionInterface;

use Ratchet\Http\HttpServer;

use Ratchet\WebSocket\WsServer;


class MyRatchet implements MessageComponentInterface {

    protected $clients;


    public function __construct() {

        $this->clients = new \SplObjectStorage;

    }


    public function onOpen(ConnectionInterface $conn) {

        // Store the new connection to send messages to later

        $this->clients->attach($conn);


        echo "New connection! ({$conn->resourceId})\n";

    }


    public function onMessage(ConnectionInterface $from, $msg) {

        $numRecv = count($this->clients) - 1;

        echo sprintf('Connection %d sending message "%s" to %d other connection%s' . "\n"

            , $from->resourceId, $msg, $numRecv, $numRecv == 1 ? '' : 's');


        foreach ($this->clients as $client) {

            if ($from !== $client) {

                // The sender is not the receiver, send to each client connected

                $client->send($msg);

            }

        }

    }


    public function onClose(ConnectionInterface $conn) {

        // The connection is closed, remove it, as we can no longer send it messages

        $this->clients->detach($conn);


        echo "Connection {$conn->resourceId} has disconnected\n";

    }


    public function onError(ConnectionInterface $conn, \Exception $e) {

        echo "An error has occurred: {$e->getMessage()}\n";


        $conn->close();

    }

}

Что я делаю не так? Почему экшн зависает? Yii 1.1.16

$server->run() вызывает бесконечный цикл, т.к. это сервер который принимает запросы в реальном времени. Экшн нужно вызывать из консоли и ставить в бэкграунд выполнение.