Skip to content

Commit 1188d0a

Browse files
committed
Support query in Websocket client.
1 parent 200b65b commit 1188d0a

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/WebSocket.php

+9-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,15 @@ public function __construct(UriInterface $uri, bool $mock = false)
3939
if ($mock) {
4040
$this->withMock($ssl);
4141
}
42-
$ret = $this->client->upgrade($uri->getPath() ?: '/');
42+
43+
parse_str($this->uri->getQuery(), $query);
44+
$query = $this->getQueryParams() + $query; //attribute value first
45+
$query = http_build_query($query);
46+
47+
$path = $this->uri->getPath() ?: '/';
48+
$path = empty($query) ? $path : $path . '?' . $query;
49+
50+
$ret = $this->client->upgrade($path);
4351
if (!$ret) {
4452
throw new ConnectException(
4553
$this, $this->client->errCode,

0 commit comments

Comments
 (0)