diff --git a/src/Illuminate/Broadcasting/BroadcastManager.php b/src/Illuminate/Broadcasting/BroadcastManager.php index 46b85817823c..975ca6e1fca6 100644 --- a/src/Illuminate/Broadcasting/BroadcastManager.php +++ b/src/Illuminate/Broadcasting/BroadcastManager.php @@ -9,6 +9,7 @@ use Illuminate\Broadcasting\Broadcasters\RedisBroadcaster; use Illuminate\Contracts\Broadcasting\Factory as FactoryContract; use Illuminate\Contracts\Broadcasting\ShouldBroadcastNow; +use Illuminate\Contracts\Bus\Dispatcher as BusDispatcherContract; use InvalidArgumentException; use Psr\Log\LoggerInterface; use Pusher\Pusher; @@ -108,10 +109,8 @@ public function event($event = null) */ public function queue($event) { - $connection = $event instanceof ShouldBroadcastNow ? 'sync' : null; - - if (is_null($connection) && isset($event->connection)) { - $connection = $event->connection; + if ($event instanceof ShouldBroadcastNow) { + return $this->app->make(BusDispatcherContract::class)->dispatchNow(new BroadcastEvent(clone $event)); } $queue = null; @@ -124,7 +123,7 @@ public function queue($event) $queue = $event->queue; } - $this->app->make('queue')->connection($connection)->pushOn( + $this->app->make('queue')->connection($event->connection ?? null)->pushOn( $queue, new BroadcastEvent(clone $event) ); }