Skip to content

Commit e4734e8

Browse files
committed
Merge branch 'master' of https://github.com/exposedev/expose
2 parents 9da0cd3 + e8a3120 commit e4734e8

File tree

2 files changed

+19
-16
lines changed

2 files changed

+19
-16
lines changed

app/ProxyManager.php

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -40,23 +40,26 @@ public function createProxy(string $clientId, $connectionData)
4040
return;
4141
}
4242

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+
}
5461
});
55-
}
56-
});
57-
}, function ($e) {
58-
// Ignore potential timeouts
59-
});
62+
});
6063

6164
$proxyConnection->send(json_encode([
6265
'event' => 'registerProxy',

builds/expose

-9 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)