From d6b6135d7cbfaaa8d0b61ee1ad2430cd50fe6be4 Mon Sep 17 00:00:00 2001 From: Alex Renoki Date: Mon, 24 Aug 2020 12:42:01 +0300 Subject: [PATCH] Removed $this->connection from RedisPusherBroadcaster --- src/Contracts/PushesToPusher.php | 3 +-- .../Broadcasters/RedisPusherBroadcaster.php | 15 ++++----------- src/WebSocketsServiceProvider.php | 3 +-- 3 files changed, 6 insertions(+), 15 deletions(-) diff --git a/src/Contracts/PushesToPusher.php b/src/Contracts/PushesToPusher.php index 4c160b3..93dd077 100644 --- a/src/Contracts/PushesToPusher.php +++ b/src/Contracts/PushesToPusher.php @@ -20,8 +20,7 @@ trait PushesToPusher return new RedisPusherBroadcaster( new Pusher($app['key'], $app['secret'], $app['id'], config('broadcasting.connections.websockets.options', [])), $app['id'], - app('redis'), - config('broadcasting.connections.websockets.connection', null) + app('redis') ); } diff --git a/src/PubSub/Broadcasters/RedisPusherBroadcaster.php b/src/PubSub/Broadcasters/RedisPusherBroadcaster.php index 1c79661..a1acb7c 100644 --- a/src/PubSub/Broadcasters/RedisPusherBroadcaster.php +++ b/src/PubSub/Broadcasters/RedisPusherBroadcaster.php @@ -35,27 +35,18 @@ class RedisPusherBroadcaster extends Broadcaster */ protected $redis; - /** - * The Redis connection to use for broadcasting. - * - * @var string|null - */ - protected $connection; - /** * Create a new broadcaster instance. * * @param Pusher $pusher * @param mixed $appId * @param \Illuminate\Contracts\Redis\Factory $redis - * @param string|null $connection */ - public function __construct(Pusher $pusher, $appId, Redis $redis, $connection = null) + public function __construct(Pusher $pusher, $appId, Redis $redis) { $this->pusher = $pusher; $this->appId = $appId; $this->redis = $redis; - $this->connection = $connection; } /** @@ -133,7 +124,9 @@ class RedisPusherBroadcaster extends Broadcaster */ public function broadcast(array $channels, $event, array $payload = []) { - $connection = $this->redis->connection($this->connection); + $connection = $this->redis->connection( + config('websockets.replication.redis.connection') ?: 'default' + ); $payload = json_encode([ 'appId' => $this->appId, diff --git a/src/WebSocketsServiceProvider.php b/src/WebSocketsServiceProvider.php index 4c687ed..e0fed12 100644 --- a/src/WebSocketsServiceProvider.php +++ b/src/WebSocketsServiceProvider.php @@ -105,8 +105,7 @@ class WebSocketsServiceProvider extends ServiceProvider return new RedisPusherBroadcaster( $pusher, $config['app_id'], - $this->app->make('redis'), - $config['connection'] ?? null + $this->app->make('redis') ); }); }