@@ -40,23 +40,26 @@ public function createProxy(string $clientId, $connectionData)
40
40
return ;
41
41
}
42
42
43
- $ this ->performRequest ($ proxyConnection , (string ) $ message , $ connectionData )->then (function (ResponseInterface $ response ) use ($ proxyConnection , &$ localRequestConnection ) {
44
- /** @var $body \React\Stream\DuplexStreamInterface */
45
- $ body = $ response ->getBody ();
46
- if ($ body ) {
47
- $ localRequestConnection = $ body ;
48
- }
49
-
50
- if ($ body ->isWritable ()) {
51
- $ body ->on ('data ' , function ($ chunk ) use ($ proxyConnection ) {
52
- $ binaryMsg = new Frame ($ chunk , true , Frame::OP_BINARY );
53
- $ proxyConnection ->send ($ binaryMsg );
43
+ $ this ->performRequest ($ proxyConnection , (string ) $ message , $ connectionData )
44
+ ->then (function ($ response ) use ($ proxyConnection , &$ localRequestConnection ) {
45
+ if (is_null ($ response )) {
46
+ return ;
47
+ }
48
+
49
+ /** @var $body \React\Stream\DuplexStreamInterface */
50
+ $ body = $ response ->getBody ();
51
+ if ($ body ) {
52
+ $ localRequestConnection = $ body ;
53
+ }
54
+
55
+ if ($ body ->isWritable ()) {
56
+ $ body ->on ('data ' , function ($ chunk ) use ($ proxyConnection ) {
57
+ $ binaryMsg = new Frame ($ chunk , true , Frame::OP_BINARY );
58
+ $ proxyConnection ->send ($ binaryMsg );
59
+ });
60
+ }
54
61
});
55
- }
56
- });
57
- }, function ($ e ) {
58
- // Ignore potential timeouts
59
- });
62
+ });
60
63
61
64
$ proxyConnection ->send (json_encode ([
62
65
'event ' => 'registerProxy ' ,
0 commit comments