Skip to content

Commit

Permalink
Fixed http to ws prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
rennokki committed Aug 3, 2021
1 parent 8654bf3 commit 1d78d9b
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions src/KubernetesCluster.php
Original file line number Diff line number Diff line change
Expand Up @@ -289,11 +289,17 @@ protected function makeRequest(string $method, string $path, string $payload = '
*/
protected function makeWsRequest(string $path, Closure $callback = null, array $query = ['pretty' => 1])
{
$url = str_replace(
['https://', 'http://'],
['wss://', 'ws://'],
$this->getCallableUrl($path, $query)
);
$url = $this->getCallableUrl($path, $query);

// Replace the HTTP protocol prefixes with WS protocols.
$replaces = [
'https://' => 'wss://',
'http://' => 'ws://',
];

foreach ($replaces as $search => $replace) {
$url = Str::replaceFirst($search, $replace, $url);
}

[$loop, $ws] = $this->getWsClient($url);

Expand Down

0 comments on commit 1d78d9b

Please sign in to comment.