File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2727 }
2828 , "require" : {
2929 "php" : " >=5.4.2"
30- , "ratchet/rfc6455" : " ^0.3.1"
30+ , "ratchet/rfc6455" : " ^0.4.0 | ^0. 3.1"
3131 , "react/socket" : " ^1.0 || ^0.8 || ^0.7 || ^0.6 || ^0.5"
3232 , "react/event-loop" : " ^1.0 || ^0.5 || ^0.4"
3333 , "guzzlehttp/psr7" : " ^1.7|^2.0"
Original file line number Diff line number Diff line change 1414use Ratchet \RFC6455 \Handshake \ServerNegotiator ;
1515use Ratchet \RFC6455 \Handshake \RequestVerifier ;
1616use React \EventLoop \LoopInterface ;
17+ use GuzzleHttp \Psr7 \HttpFactory ;
1718use GuzzleHttp \Psr7 \Message ;
1819
1920/**
@@ -86,7 +87,13 @@ public function __construct(ComponentInterface $component) {
8687 $ this ->connections = new \SplObjectStorage ;
8788
8889 $ this ->closeFrameChecker = new CloseFrameChecker ;
89- $ this ->handshakeNegotiator = new ServerNegotiator (new RequestVerifier );
90+
91+ if (self ::isRFC6455v03 ()) {
92+ $ this ->handshakeNegotiator = new ServerNegotiator (new RequestVerifier );
93+ } else {
94+ $ this ->handshakeNegotiator = new ServerNegotiator (new RequestVerifier , new HttpFactory );
95+ }
96+
9097 $ this ->handshakeNegotiator ->setStrictSubProtocolCheck (true );
9198
9299 if ($ component instanceof WsServerInterface) {
@@ -101,6 +108,11 @@ public function __construct(ComponentInterface $component) {
101108 };
102109 }
103110
111+ private static function isRFC6455v03 () {
112+ $ reflection = new \ReflectionClass ('Ratchet\RFC6455\Handshake\ServerNegotiator ' );
113+ return $ reflection ->getMethod ('__construct ' )->getNumberOfRequiredParameters () === 1 ;
114+ }
115+
104116 /**
105117 * {@inheritdoc}
106118 */
You can’t perform that action at this time.
0 commit comments