-
Notifications
You must be signed in to change notification settings - Fork 181
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support "pusher:subscription_error" event #177
Comments
How would this exactly work? Something like an |
I could see subscription errors coming back in firefoxes console. I wanted to be able to execute a function when the subscription failed. I prefer something like 'subscription_error', however 'error' would be fine if there was a type for 'subscription_error', so I handle that very specific case. Also thanks for looking into this @driesvints , knowing that we didn't make the socket connection and being able to handle it allows us to write less code. For example: dealing with a user that logs in to an application simultaneously using multiple browsers. |
@driesvints: I guess I'd like to handle errors in a callback and if there is no callback maybe rethrow the exception or just call Echo.join(`chat.${roomId}`)
.here(...)
.joining(...)
.leaving(...)
.listen('NewMessage', ...)
.subscriptionError(err => {
// Sentry.captureException(err);
}); |
Is there a way to do a type check on the error? Something like this: Echo.join(`chat.${roomId}`)
.here(...)
.joining(...)
.leaving(...)
.listen('NewMessage', ...)
.error(err => {
if (err.type === 'subscription') {
// do whatever type related
}
// Sentry.captureException(err);
}); Reason why I want to do it this way is to just provide a generic way of catching errors so people can do whatever they want. |
That'd be great. Echo.join(`chat.${roomId}`)
.here(...)
.joining(...)
.leaving(...)
.listen('NewMessage', ...)
.error((err, type) => {
// type = subscription
// err = Error object
}); |
Okay so I don't know when I'll have time to work on this but feel free to send in a PR if you get to it before me. |
Sent a PR for this here: #284 @tillkruss would be great if you could give feedback on my notes on the private channel thing on the PR. |
@driesvints: LGTM. Haven't tested it, I don't think we use that code anymore. |
Support for
pusher:subscription_error
would be nice. It only applied toprivate
andpresence
channels.pusher:subscription_succeeded
could be moved to basic pusher channel, because it's triggered for all channel types.https://pusher.com/docs/client_api_guide/client_events#subscription_error
The text was updated successfully, but these errors were encountered: