Commit 3250da39 authored by Mat's avatar Mat

une autre méthode pour initialiser le serveur websocket

parent b977d9f1
......@@ -9,6 +9,7 @@
namespace SocketBundle\Command;
use Ratchet\App;
use Ratchet\Http\HttpServer;
use Ratchet\Server\IoServer;
use Ratchet\WebSocket\WsServer;
......@@ -39,15 +40,23 @@ class WsCommand extends ContainerAwareCommand
protected function execute(InputInterface $input, OutputInterface $output)
{
$output->write("Tentative de connexion au chat");
/*
// méthode 1
$server = IoServer::factory(
new HttpServer(
new WsServer(
new ChatHub($this->getContainer())
)
), 8088
), 8088, '/'
);
$server->run();
*/
// méthode 2
$server = new App('localhost', 8088);
$server->route('/', new ChatHub($this->getContainer()));
$server->run();
//parent::execute($input, $output); // pas nécessaire ici
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment