Add WSS support using recently added class SecureServer from React.
This commit is contained in:
parent
945a887abd
commit
369227dc1c
@ -5,6 +5,7 @@ use React\EventLoop\LoopInterface;
|
||||
use React\Socket\ServerInterface;
|
||||
use React\EventLoop\Factory as LoopFactory;
|
||||
use React\Socket\Server as Reactor;
|
||||
use React\Socket\SecureServer as SecureReactor;
|
||||
|
||||
/**
|
||||
* Creates an open-ended socket to listen on a port for incoming connections.
|
||||
@ -64,9 +65,12 @@ class IoServer {
|
||||
* @param string $address The address to receive sockets on (0.0.0.0 means receive connections from any)
|
||||
* @return IoServer
|
||||
*/
|
||||
public static function factory(MessageComponentInterface $component, $port = 80, $address = '0.0.0.0') {
|
||||
public static function factory(MessageComponentInterface $component, $port = 80, $address = '0.0.0.0', $sslconf = array()) {
|
||||
$loop = LoopFactory::create();
|
||||
$socket = new Reactor($loop);
|
||||
if (!empty($sslconf)) {
|
||||
$socket = new SecureReactor($socket, $loop, $sslconf);
|
||||
}
|
||||
$socket->listen($port, $address);
|
||||
|
||||
return new static($component, $socket, $loop);
|
||||
|
Loading…
Reference in New Issue
Block a user