Skip to content

Commit 25f6e32

Browse files
authored
Merge pull request #137 from Textalk/persistent-fix
Fix for persistent connection in client
2 parents caa1610 + 06e40b7 commit 25f6e32

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

lib/Client.php

+2-4
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,8 @@ protected function connect(): void
128128
throw new ConnectionException($error);
129129
}
130130

131+
$address = "{$scheme}://{$host}{$path_with_query}";
132+
131133
if (!$persistent || ftell($this->socket) == 0) {
132134
// Set timeout on the stream as well.
133135
stream_set_timeout($this->socket, $this->options['timeout']);
@@ -177,10 +179,6 @@ function ($key, $value) {
177179
// Get server response header (terminated with double CR+LF).
178180
$response = stream_get_line($this->socket, 1024, "\r\n\r\n");
179181

180-
/// @todo Handle version switching
181-
182-
$address = "{$scheme}://{$host}{$path_with_query}";
183-
184182
// Validate response.
185183
if (!preg_match('#Sec-WebSocket-Accept:\s(.*)$#mUi', $response, $matches)) {
186184
$error = "Connection to '{$address}' failed: Server sent invalid upgrade response: {$response}";

0 commit comments

Comments
 (0)