Merge branch 'pr/485-react-socket' into 0.4

# Conflicts:
#	composer.json
This commit is contained in:
Chris Boden 2017-09-10 11:38:45 -04:00
commit c5055fa6f2
4 changed files with 8 additions and 14 deletions

View File

@ -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)

View File

@ -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"

View File

@ -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;
$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),
'[]'
);

View File

@ -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);
}