55use Aws \ApiGatewayManagementApi \Exception \ApiGatewayManagementApiException ;
66use Illuminate \Broadcasting \Broadcasters \Broadcaster ;
77use Illuminate \Broadcasting \Broadcasters \UsePusherChannelConventions ;
8+ use Illuminate \Broadcasting \Channel ;
89use Illuminate \Support \Arr ;
910use Illuminate \Support \Str ;
1011use Symfony \Component \HttpKernel \Exception \AccessDeniedHttpException ;
@@ -103,9 +104,9 @@ protected function generateSignaturePresence(string $channel, string $socketId,
103104 /**
104105 * Broadcast the given event.
105106 *
106- * @param array $channels
107- * @param string $event
108- * @param array $payload
107+ * @param Channel[] $channels
108+ * @param string $event
109+ * @param array $payload
109110 * @return void
110111 *
111112 * @throws \Illuminate\Broadcasting\BroadcastException
@@ -117,13 +118,13 @@ public function broadcast(array $channels, $event, array $payload = [])
117118 foreach ($ channels as $ channel ) {
118119 $ data = json_encode ([
119120 'event ' => $ event ,
120- 'channel ' => $ channel ,
121+ 'channel ' => $ channel-> name ,
121122 'data ' => $ payload ,
122123 ], JSON_THROW_ON_ERROR );
123124
124125 $ this ->subscriptionRepository ->getConnectionIdsForChannel ($ channel )
125126 ->reject (fn ($ connectionId ) => $ connectionId === $ skipConnectionId )
126- ->tap (fn ($ connectionIds ) => logger ()->debug ("Preparing to send to connections for channel ' {$ channel }' " , $ connectionIds ->toArray ()))
127+ ->tap (fn ($ connectionIds ) => logger ()->debug ("Preparing to send to connections for channel ' {$ channel-> name }' " , $ connectionIds ->toArray ()))
127128 ->each (fn (string $ connectionId ) => $ this ->sendMessage ($ connectionId , $ data ));
128129 }
129130
0 commit comments