add bind option
This commit is contained in:
parent
4a1708abf5
commit
f29e7ca48f
|
@ -43,7 +43,8 @@ $ php server/src/resource/server.php
|
|||
The server can be run with verbosity:
|
||||
|
||||
* `-v` or `--verbose` to show server messages
|
||||
* `--vv` to show handlers messages
|
||||
* `-m` or `--message` to show client messages
|
||||
* `-b` or `--bind` to define server address to bind (default: `0.0.0.0`)
|
||||
|
||||
Open `http://your.local.ip:15000` and enjoy!
|
||||
|
||||
|
|
|
@ -8,12 +8,12 @@ use Ratchet\WebSocket\WsServer;
|
|||
use Ratchet\ConnectionInterface;
|
||||
|
||||
$options = getopt(
|
||||
'v',
|
||||
['verbose', 'vv']
|
||||
'vmb:',
|
||||
['verbose', 'message', 'bind:']
|
||||
);
|
||||
|
||||
$serverOutput = new Output(isset($options['v']) || isset($options['verbose']));
|
||||
$messageOutput = new Output(isset($options['vv']));
|
||||
$messageOutput = new Output(isset($options['message']));
|
||||
$server = new Server($serverOutput);
|
||||
$shell = new Shell();
|
||||
|
||||
|
@ -202,7 +202,8 @@ $server->addMessageHandler('messages', function (ConnectionInterface $from, arra
|
|||
|
||||
$webSocker = IoServer::factory(
|
||||
new HttpServer(new WsServer($server)),
|
||||
14598
|
||||
14598,
|
||||
$options['b'] ?? $options['bind'] ?? '0.0.0.0'
|
||||
);
|
||||
|
||||
$webSocker->run();
|
||||
|
|
Loading…
Reference in a new issue