I'm trying to add a callback for a pusher:subscription_error with echo-laravel. The client is done in react. The broadcaster is Pusher and I subscribe to a channel like this:
echo.private('User.' + this.props.user.id).listen("NewMessage", (newMessage) => {
if (newMessage.message.message_room_id === this.state.selectedMessage.id) {
this.props.newMessageInOpenBox(newMessage);
} else {
this.props.newMessage(newMessage);
}
}
)
Im trying to get the failed subscription callback working so i can trigger a token refresh. How would i catch the subscription error? i couldn't find anything in the docs or elsewhere.
for anyone having the same problem i found that you have to go into the channel like this
echo.connector.pusher.channels.channels['private-' + channelName].bind('pusher:subscription_error', () => {
alert('sub error')
})