diff --git a/config/configuration.sample.yml b/config/configuration.sample.yml index 2676a56c24..56aee3c5be 100644 --- a/config/configuration.sample.yml +++ b/config/configuration.sample.yml @@ -39,14 +39,14 @@ main: host: 127.0.0.1 port: 6660 linger: 500 - publisher: - protocol: tcp - host: 127.0.0.1 - port: 13598 websocket-server: host: local.phrasea port: 9090 ip: 0.0.0.0 + subscriber: + protocol: tcp + host: 127.0.0.1 + port: 13598 session: type: 'file' options: [] diff --git a/lib/Alchemy/Phrasea/Command/WebsocketServer.php b/lib/Alchemy/Phrasea/Command/WebsocketServer.php index 2a82239ce1..af506ada8e 100644 --- a/lib/Alchemy/Phrasea/Command/WebsocketServer.php +++ b/lib/Alchemy/Phrasea/Command/WebsocketServer.php @@ -21,8 +21,7 @@ class WebsocketServer extends Command { parent::__construct($name); - $this - ->setDescription("Runs the websocket server"); + $this->setDescription("Runs the websocket server"); } public function doExecute(InputInterface $input, OutputInterface $output) diff --git a/lib/Alchemy/Phrasea/Core/CLIProvider/WebsocketServerServiceProvider.php b/lib/Alchemy/Phrasea/Core/CLIProvider/WebsocketServerServiceProvider.php index dbc88ddf64..94e5dcc75f 100644 --- a/lib/Alchemy/Phrasea/Core/CLIProvider/WebsocketServerServiceProvider.php +++ b/lib/Alchemy/Phrasea/Core/CLIProvider/WebsocketServerServiceProvider.php @@ -34,7 +34,7 @@ class WebsocketServerServiceProvider implements ServiceProviderInterface 'protocol' => 'tcp', 'host' => '127.0.0.1', 'port' => 13598, - ], $app['conf']->get(['main', 'task-manager', 'publisher'], [])); + ], $app['conf']->get(['main', 'websocket-server', 'subscriber'], [])); }); $app['ws.task-manager.broadcaster'] = $app->share(function (Application $app) { diff --git a/lib/Alchemy/Phrasea/Websocket/PhraseanetWampServer.php b/lib/Alchemy/Phrasea/Websocket/PhraseanetWampServer.php index 1b7fe32b76..e0e6538e78 100644 --- a/lib/Alchemy/Phrasea/Websocket/PhraseanetWampServer.php +++ b/lib/Alchemy/Phrasea/Websocket/PhraseanetWampServer.php @@ -27,18 +27,27 @@ class PhraseanetWampServer implements WampServerInterface $this->manager = $manager; } + /** + * {@inheritdoc} + */ public function onPublish(Conn $conn, $topic, $event, array $exclude, array $eligible) { $this->logger->error(sprintf('Publishing on topic %s', $topic->getId()), array('event' => $event, 'topic' => $topic)); $topic->broadcast($event); } + /** + * {@inheritdoc} + */ public function onCall(Conn $conn, $id, $topic, array $params) { $this->logger->error(sprintf('Received RPC call on topic %s', $topic->getId()), array('topic' => $topic)); $conn->callError($id, $topic, 'RPC not supported on this demo'); } + /** + * {@inheritdoc} + */ public function onSubscribe(Conn $conn, $topic) { if ($this->manager->subscribe($conn, $topic)) { @@ -48,24 +57,36 @@ class PhraseanetWampServer implements WampServerInterface } } + /** + * {@inheritdoc} + */ public function onUnSubscribe(Conn $conn, $topic) { $this->logger->debug(sprintf('Unsubscription received on topic %s', $topic->getId()), array('topic' => $topic)); $this->manager->unsubscribe($conn, $topic); } + /** + * {@inheritdoc} + */ public function onOpen(Conn $conn) { $this->logger->debug('[WS] Connection request accepted'); $this->manager->openConnection($conn); } + /** + * {@inheritdoc} + */ public function onClose(Conn $conn) { $this->logger->debug('[WS] Connection closed'); $this->manager->closeConnection($conn); } + /** + * {@inheritdoc} + */ public function onError(Conn $conn, \Exception $e) { $this->logger->error('[WS] Connection error', ['exception' => $e]); diff --git a/lib/Alchemy/Phrasea/Websocket/Topics/Plugin/PluginInterface.php b/lib/Alchemy/Phrasea/Websocket/Topics/Plugin/PluginInterface.php index 36ef65e4d7..2edd0eb74c 100644 --- a/lib/Alchemy/Phrasea/Websocket/Topics/Plugin/PluginInterface.php +++ b/lib/Alchemy/Phrasea/Websocket/Topics/Plugin/PluginInterface.php @@ -16,7 +16,7 @@ use Alchemy\Phrasea\Websocket\Topics\TopicsManager; interface PluginInterface { /** - * Attaches a Plugn to the TopicsManager + * Attaches a Plugin to the TopicsManager * * @param TopicsManager $manager */ diff --git a/lib/classes/patch/390alpha11a.php b/lib/classes/patch/390alpha11a.php index b4ddddc1b9..643d7a79c3 100644 --- a/lib/classes/patch/390alpha11a.php +++ b/lib/classes/patch/390alpha11a.php @@ -69,7 +69,7 @@ class patch_390alpha11a implements patchInterface 'port' => 6660, 'linger' => 500, ]); - $app['conf']->set(['main', 'task-manager', 'publisher'], [ + $app['conf']->set(['main', 'websocket-server', 'subscriber'], [ 'protocol' => 'tcp', 'host' => '127.0.0.1', 'port' => 13598, diff --git a/lib/conf.d/configuration.yml b/lib/conf.d/configuration.yml index 7d6c9f0739..56273b61a5 100644 --- a/lib/conf.d/configuration.yml +++ b/lib/conf.d/configuration.yml @@ -39,14 +39,14 @@ main: host: 127.0.0.1 port: 6660 linger: 500 - publisher: - protocol: tcp - host: 127.0.0.1 - port: 13598 websocket-server: host: local.phrasea port: 9090 ip: 0.0.0.0 + subscriber: + protocol: tcp + host: 127.0.0.1 + port: 13598 session: type: 'file' options: [] diff --git a/tests/Alchemy/Tests/Phrasea/Controller/SetupTest.php b/tests/Alchemy/Tests/Phrasea/Controller/SetupTest.php index 67e928b608..1d2181b2c3 100644 --- a/tests/Alchemy/Tests/Phrasea/Controller/SetupTest.php +++ b/tests/Alchemy/Tests/Phrasea/Controller/SetupTest.php @@ -105,7 +105,7 @@ class SetupTest extends \PhraseanetWebTestCase ->disableOriginalConstructor() ->getMock(); - $user->expects($this->exactly(2)) + $user->expects($this->exactly(1)) ->method('get_id') ->will($this->returnValue(self::$DI['user']->get_id()));