Skip to content

Commit 3b6125c

Browse files
authored
Merge pull request #929 from ratchetphp/v0.4.4
v0.4.4
2 parents 78fb27b + 274054c commit 3b6125c

File tree

11 files changed

+29
-18
lines changed

11 files changed

+29
-18
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@ CHANGELOG
88

99
---
1010

11+
* 0.4.4 (2021-12-11)
12+
* Correct and update dependencies for forward compatibility
13+
* Added context for React Socket server to App
14+
* Use non-deprecated Guzzle API calls
15+
1116
* 0.4.3 (2020-06-04)
1217
* BF: Fixed interface acceptable regression in `App`
1318
* Update RFC6455 library with latest fixes

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright (c) 2011-2020 Chris Boden
1+
Copyright (c) 2011 Chris Boden
22

33
Permission is hereby granted, free of charge, to any person obtaining a copy
44
of this software and associated documentation files (the "Software"), to deal

composer.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,12 @@
2727
}
2828
, "require": {
2929
"php": ">=5.4.2"
30-
, "ratchet/rfc6455": "^0.3"
30+
, "ratchet/rfc6455": "^0.3.1"
3131
, "react/socket": "^1.0 || ^0.8 || ^0.7 || ^0.6 || ^0.5"
32-
, "guzzlehttp/psr7": "^1.0"
33-
, "symfony/http-foundation": "^2.6|^3.0|^4.0|^5.0"
34-
, "symfony/routing": "^2.6|^3.0|^4.0|^5.0"
32+
, "react/event-loop": ">=0.4"
33+
, "guzzlehttp/psr7": "^1.7|^2.0"
34+
, "symfony/http-foundation": "^2.6|^3.0|^4.0|^5.0|^6.0"
35+
, "symfony/routing": "^2.6|^3.0|^4.0|^5.0|^6.0"
3536
}
3637
, "require-dev": {
3738
"phpunit/phpunit": "~4.8"

src/Ratchet/App.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,9 @@ class App {
6161
* @param int $port Port to listen on. If 80, assuming production, Flash on 843 otherwise expecting Flash to be proxied through 8843
6262
* @param string $address IP address to bind to. Default is localhost/proxy only. '0.0.0.0' for any machine.
6363
* @param LoopInterface $loop Specific React\EventLoop to bind the application to. null will create one for you.
64+
* @param array $context
6465
*/
65-
public function __construct($httpHost = 'localhost', $port = 8080, $address = '127.0.0.1', LoopInterface $loop = null) {
66+
public function __construct($httpHost = 'localhost', $port = 8080, $address = '127.0.0.1', LoopInterface $loop = null, $context = array()) {
6667
if (extension_loaded('xdebug') && getenv('RATCHET_DISABLE_XDEBUG_WARN') === false) {
6768
trigger_error('XDebug extension detected. Remember to disable this if performance testing or going live!', E_USER_WARNING);
6869
}
@@ -74,7 +75,7 @@ public function __construct($httpHost = 'localhost', $port = 8080, $address = '1
7475
$this->httpHost = $httpHost;
7576
$this->port = $port;
7677

77-
$socket = new Reactor($address . ':' . $port, $loop);
78+
$socket = new Reactor($address . ':' . $port, $loop, $context);
7879

7980
$this->routes = new RouteCollection;
8081
$this->_server = new IoServer(new HttpServer(new Router(new UrlMatcher($this->routes, new RequestContext))), $socket, $loop);

src/Ratchet/ConnectionInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* The version of Ratchet being used
66
* @var string
77
*/
8-
const VERSION = 'Ratchet/0.4.3';
8+
const VERSION = 'Ratchet/0.4.4';
99

1010
/**
1111
* A proxy object representing a connection to the application

src/Ratchet/Http/CloseResponseTrait.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22
namespace Ratchet\Http;
33
use Ratchet\ConnectionInterface;
4-
use GuzzleHttp\Psr7 as gPsr;
4+
use GuzzleHttp\Psr7\Message;
55
use GuzzleHttp\Psr7\Response;
66

77
trait CloseResponseTrait {
@@ -16,7 +16,7 @@ private function close(ConnectionInterface $conn, $code = 400, array $additional
1616
'X-Powered-By' => \Ratchet\VERSION
1717
], $additional_headers));
1818

19-
$conn->send(gPsr\str($response));
19+
$conn->send(Message::toString($response));
2020
$conn->close();
2121
}
22-
}
22+
}

src/Ratchet/Http/HttpRequestParser.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
namespace Ratchet\Http;
33
use Ratchet\MessageInterface;
44
use Ratchet\ConnectionInterface;
5-
use GuzzleHttp\Psr7 as gPsr;
5+
use GuzzleHttp\Psr7\Message;
66

77
/**
88
* This class receives streaming data from a client request
@@ -59,6 +59,6 @@ public function isEom($message) {
5959
* @return \Psr\Http\Message\RequestInterface
6060
*/
6161
public function parse($headers) {
62-
return gPsr\parse_request($headers);
62+
return Message::parseRequest($headers);
6363
}
6464
}

src/Ratchet/Http/Router.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
use Symfony\Component\Routing\Matcher\UrlMatcherInterface;
66
use Symfony\Component\Routing\Exception\MethodNotAllowedException;
77
use Symfony\Component\Routing\Exception\ResourceNotFoundException;
8-
use GuzzleHttp\Psr7 as gPsr;
8+
use GuzzleHttp\Psr7\Query;
99

1010
class Router implements HttpServerInterface {
1111
use CloseResponseTrait;
@@ -61,9 +61,9 @@ public function onOpen(ConnectionInterface $conn, RequestInterface $request = nu
6161
$parameters[$key] = $value;
6262
}
6363
}
64-
$parameters = array_merge($parameters, gPsr\parse_query($uri->getQuery() ?: ''));
64+
$parameters = array_merge($parameters, Query::parse($uri->getQuery() ?: ''));
6565

66-
$request = $request->withUri($uri->withQuery(gPsr\build_query($parameters)));
66+
$request = $request->withUri($uri->withQuery(Query::build($parameters)));
6767

6868
$conn->controller = $route['_controller'];
6969
$conn->controller->onOpen($conn, $request);

src/Ratchet/Wamp/Topic.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,13 +86,15 @@ public function remove(ConnectionInterface $conn) {
8686
/**
8787
* {@inheritdoc}
8888
*/
89+
#[\ReturnTypeWillChange]
8990
public function getIterator() {
9091
return $this->subscribers;
9192
}
9293

9394
/**
9495
* {@inheritdoc}
9596
*/
97+
#[\ReturnTypeWillChange]
9698
public function count() {
9799
return $this->subscribers->count();
98100
}

src/Ratchet/WebSocket/WsServer.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
use Ratchet\RFC6455\Handshake\ServerNegotiator;
1515
use Ratchet\RFC6455\Handshake\RequestVerifier;
1616
use React\EventLoop\LoopInterface;
17-
use GuzzleHttp\Psr7 as gPsr;
17+
use GuzzleHttp\Psr7\Message;
1818

1919
/**
2020
* The adapter to handle WebSocket requests/responses
@@ -116,7 +116,7 @@ public function onOpen(ConnectionInterface $conn, RequestInterface $request = nu
116116

117117
$response = $this->handshakeNegotiator->handshake($request)->withHeader('X-Powered-By', \Ratchet\VERSION);
118118

119-
$conn->send(gPsr\str($response));
119+
$conn->send(Message::toString($response));
120120

121121
if (101 !== $response->getStatusCode()) {
122122
return $conn->close();

0 commit comments

Comments
 (0)