antidot-framework /
react-socket-server
| 1 | <?php |
||
| 2 | |||
| 3 | declare(strict_types=1); |
||
| 4 | |||
| 5 | namespace Antidot\React\Socket; |
||
| 6 | |||
| 7 | use Ratchet\Http\HttpServer; |
||
| 8 | use Ratchet\Server\IoServer; |
||
| 9 | use Ratchet\Wamp\WampServer; |
||
| 10 | use Ratchet\WebSocket\WsServer; |
||
| 11 | use React\EventLoop\Factory; |
||
| 12 | |||
| 13 | class Server |
||
| 14 | { |
||
| 15 | public function __invoke(array $config): void |
||
| 16 | { |
||
| 17 | $loop = Factory::create(); |
||
| 18 | $application = new Application(); |
||
| 19 | $loop->addTimer(0.001, function($timer) use ($config) { |
||
|
0 ignored issues
–
show
|
|||
| 20 | echo \sprintf("Socket server listening to tcp://%s.\n", $config['uri']); |
||
| 21 | }); |
||
| 22 | |||
| 23 | $webSocket = new \React\Socket\Server($config['uri'], $loop); |
||
| 24 | $server = new IoServer( |
||
|
0 ignored issues
–
show
|
|||
| 25 | new HttpServer( |
||
| 26 | new WsServer( |
||
| 27 | new WampServer( |
||
| 28 | $application |
||
| 29 | ) |
||
| 30 | ) |
||
| 31 | ), |
||
| 32 | $webSocket |
||
| 33 | ); |
||
| 34 | |||
| 35 | $loop->run(); |
||
| 36 | } |
||
| 37 | } |
||
| 38 |
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.