diff --git a/CHANGELOG.md b/CHANGELOG.md index 102495d..e200b86 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,11 +13,12 @@ CHANGELOG * BC: $conn->WebSocket->request replaced with $conn->httpRequest which is a PSR-7 object * Binary messages now supported via Ratchet\WebSocket\MessageComponentInterface * Added heartbeat support via ping/pong in WsServer + * SSL now supported * BC: No longer support old (and insecure) Hixie76 and Hybi protocols * BC: No longer support disabling UTF-8 checks * BC: The Session component implements HttpServerInterface instead of WsServerInterface * BC: PHP 5.3 no longer supported - * BC: Use react/socket 0.5 + * BC: Update to newer version of react/socket dependency * Significant performance enhancements * 0.3.6 (2017-01-06) diff --git a/composer.json b/composer.json index bc5626b..e92ec80 100644 --- a/composer.json +++ b/composer.json @@ -28,7 +28,7 @@ , "require": { "php": ">=5.4.2" , "ratchet/rfc6455": "^0.2" - , "react/socket": "^0.7 || ^0.6 || ^0.5" + , "react/socket": "^1.0 || ^0.8 || ^0.7 || ^0.6 || ^0.5" , "guzzlehttp/psr7": "^1.0" , "symfony/http-foundation": "^2.2|^3.0" , "symfony/routing": "^2.2|^3.0" diff --git a/src/Ratchet/Server/IoServer.php b/src/Ratchet/Server/IoServer.php index 997bb99..1669b78 100644 --- a/src/Ratchet/Server/IoServer.php +++ b/src/Ratchet/Server/IoServer.php @@ -22,13 +22,6 @@ class IoServer { */ public $app; - /** - * Array of React event handlers - * @var \SplFixedArray - * @deprecated exists BC only, now unused - */ - protected $handlers; - /** * The socket server the Ratchet Application is run off of * @var \React\Socket\ServerInterface @@ -53,8 +46,6 @@ class IoServer { $this->socket = $socket; $socket->on('connection', array($this, 'handleConnect')); - - $this->handlers = new \SplFixedArray(3); } /** @@ -93,10 +84,11 @@ class IoServer { */ public function handleConnect($conn) { $conn->decor = new IoConnection($conn); + $conn->decor->resourceId = (int)$conn->stream; - $conn->decor->resourceId = (int)$conn->stream; + $uri = $conn->getRemoteAddress(); $conn->decor->remoteAddress = trim( - parse_url('tcp://' . $conn->getRemoteAddress(), PHP_URL_HOST), + parse_url((strpos($uri, '://') === false ? 'tcp://' : '') . $uri, PHP_URL_HOST), '[]' ); diff --git a/tests/unit/Server/IoServerTest.php b/tests/unit/Server/IoServerTest.php index ec54b5d..284fbde 100644 --- a/tests/unit/Server/IoServerTest.php +++ b/tests/unit/Server/IoServerTest.php @@ -22,7 +22,8 @@ class IoServerTest extends \PHPUnit_Framework_TestCase { $loop = new StreamSelectLoop; $this->reactor = new Server(0, $loop); - $this->port = parse_url('tcp://' . $this->reactor->getAddress(), PHP_URL_PORT); + $uri = $this->reactor->getAddress(); + $this->port = parse_url((strpos($uri, '://') === false ? 'tcp://' : '') . $uri, PHP_URL_PORT); $this->server = new IoServer($this->app, $this->reactor, $loop); }