Files
money/ws/setup/ws/setups.php
2021-03-30 16:40:02 -03:00

37 lines
1.5 KiB
PHP

<?php
use Psr\Container\ContainerInterface as Container;
return [
'storage' => function(Container $c) {
return new \SplObjectStorage();
},
ProVM\Common\Factory\Event\Request::class => function(Container $c) {
return new ProVM\Common\Factory\Event\Request();
},
ProVM\Common\Factory\Event\Response::class => function(Container $c) {
return new ProVM\Common\Factory\Event\Response();
},
ProVM\Common\Factory\Event\Listener::class => function(Container $c) {
return new ProVM\Common\Factory\Event\Listener($c);
},
Psr\EventDispatcher\EventDispatcherInterface::class => function(Container $c) {
return new ProVM\Common\Service\Event\Dispatcher($c);
},
Ratchet\MessageComponentInterface::class => function(Container $c) {
return (new ProVM\Common\Alias\Event\Message($c->get('storage')))
->setDispatcher($c->get(Psr\EventDispatcher\EventDispatcherInterface::class))
->setRequestBuilder($c->get(ProVM\Common\Factory\Event\Request::class));
},
Ratchet\WebSocket\WsServer::class => function(Container $c) {
return new Ratchet\WebSocket\WsServer($c->get(Ratchet\MessageComponentInterface::class));
},
Ratchet\Http\HttpServer::class => function(Container $c) {
return new Ratchet\Http\HttpServer($c->get(Ratchet\WebSocket\WsServer::class));
},
Ratchet\Server\IoServer::class => function(Container $c) {
$app = ProVM\Common\Alias\Server\App::factory($c->get(Ratchet\Http\HttpServer::class), $c->get('port'));
$app->setContainer($c);
return $app;
}
];