diff --git a/Pusher.php b/Pusher.php index a502d80..fdfb967 100644 --- a/Pusher.php +++ b/Pusher.php @@ -109,11 +109,7 @@ public function flush() */ public function listen($channels, $callback = null) { - $endpoint = $this->makeEndpoint(array_merge($this->serverOptions, $this->listenServerOptions)); - if (substr($endpoint, -1) != '/') { - $endpoint .= '/'; - } - $endpoint .= implode($this->channelSplitter, (array)$channels); + $endpoint = $this->getListenerHost($channels); $response = $this->client->get($endpoint, [ 'stream' => true @@ -129,6 +125,17 @@ public function listen($channels, $callback = null) } } + public function getListenerHost($channels) + { + $endpoint = $this->makeEndpoint(array_merge($this->serverOptions, $this->listenServerOptions)); + if (substr($endpoint, -1) != '/') { + $endpoint .= '/'; + } + $endpoint .= implode($this->channelSplitter, (array)$channels); + + return $endpoint; + } + /** * * @param $serverOptions array of server options diff --git a/composer.json b/composer.json index 586e992..cb2b315 100644 --- a/composer.json +++ b/composer.json @@ -12,7 +12,7 @@ ], "require": { "php": ">=7.2", - "yiisoft/yii2": "*", + "yiisoft/yii2": "^2.0", "guzzlehttp/guzzle": "^6.2" }, "autoload": {