My Scenario
Im trying to get laravel to work with pusher without the use of laravel echo, everything works on a public channel but when i switch to a private channel in the broadcastOn()
method of my event pusher on the frontend doesn't pick anything up anymore. It gets logged in my pusher applications event log as a private channel but pusher on the frontend just sais no.
I've set up and returned true for the channel code like this:
Broadcast::channel('application', function ($post, $username) {
if(true){
return true;
}
});
This is my event code:
public function broadcastOn()
{
return new PrivateChannel('application');
}
The class implements ShouldBroadcast
and lastly here is my front end code:
<script>
//instantiate a Pusher object with our Credential's key
var pusher = new Pusher('MY_KEY', {
cluster: 'en',
encrypted: true
});
//Subscribe to the channel we specified in our Laravel Event
var channel = pusher.subscribe('application');
//Bind a function to a Event (the full Laravel class)
channel.bind('App\\Events\\PostMessage', function(){
console.log('Event Logged');
});
</script>
My Question
Why is my pusher front end code not detecting my private broadcast?