Commit 3250da39 authored by Mat's avatar Mat

une autre méthode pour initialiser le serveur websocket

parent b977d9f1
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
namespace SocketBundle\Command; namespace SocketBundle\Command;
use Ratchet\App;
use Ratchet\Http\HttpServer; use Ratchet\Http\HttpServer;
use Ratchet\Server\IoServer; use Ratchet\Server\IoServer;
use Ratchet\WebSocket\WsServer; use Ratchet\WebSocket\WsServer;
...@@ -39,15 +40,23 @@ class WsCommand extends ContainerAwareCommand ...@@ -39,15 +40,23 @@ class WsCommand extends ContainerAwareCommand
protected function execute(InputInterface $input, OutputInterface $output) protected function execute(InputInterface $input, OutputInterface $output)
{ {
$output->write("Tentative de connexion au chat"); $output->write("Tentative de connexion au chat");
/*
// méthode 1
$server = IoServer::factory( $server = IoServer::factory(
new HttpServer( new HttpServer(
new WsServer( new WsServer(
new ChatHub($this->getContainer()) 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 //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