May 30, 2023
0
Level 5
Pusher listen to public channels only
I am trying to listen to Pusher but i can listen only when the channel is public , at first i tried to add channel name like (my-channel) then i found Pusher send the channel name on private (private-channel-name) so i changed to private-channel-name but still no response came on the console
var pusher = new Pusher('my-key', {
cluster: 'sa1'
});
var channel = pusher.subscribe('private-my-channel');
channel.bind('status', function(data) {
console.log(data);
});
my laravel event
public $user;
public function __construct(array $user)
{
$this->user = $user;
}
public function broadcastOn(): array
{
return [
new PrivateChannel('my-channel'),
];
}
public function broadcastAs()
{
return 'status';
}
Please or to participate in this conversation.