Laravel

laravel reverb private channel with sanctum

i have a problem in laravel reverb with private channel with sanctum auth i make change in bootstrap/app.php : ->withBroadcasting( DIR.'/../routes/channels.php', ['prefix' => 'api', 'middleware' => ['api','auth:sanctum']], ) and this this my event : public function __construct(public PrivateChatMessage $privateChatMessage) { }

/**
 * Get the channels the event should broadcast on.
 *
 * @return array<int, \Illuminate\Broadcasting\Channel>
 */
public function broadcastOn(): array
{

    return [
        new PrivateChannel("chat." . $this->privateChatMessage->private_chat_id),
    ];
}

public function broadcastWith(): array
{
    return [
        'id'=>1,
       'message'=>'test'
    ];
}

public function broadcastAs(): string
{
    return 'user.chat';
}

when send message from postman noting happen and when use mobile to send message get this reponse in larabel debug :

{ "event": "pusher:subscribe", "data": { "channel": "chat.2", "auth": "ed5zsi5ebpdmawcqbwva:9e87ca525bdfc96735423e9295272af8c456e4914814a2c8bfdb98feae6f8006" } } i need help if you can ,thanks in advance

eng-badr
eng-badr
0
0
344