0

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.

1 Answer 1

1

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')
})
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.