From 438d7039387cd38813232bbb308c933e7ac5da60 Mon Sep 17 00:00:00 2001 From: Vladimir Zbrailov Date: Mon, 26 Oct 2020 14:30:04 +0300 Subject: [PATCH] fix --- Pusher.php | 17 ++++++++++++----- composer.json | 2 +- 2 files changed, 13 insertions(+), 6 deletions(-) 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": {