Skip to content
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

{"type":"WebSocketError","error":{"type":"PusherError","data":{"code":1006,"message":"Connection interrupted (undefined)"}}} #744

Open
sobrinho opened this issue Jul 26, 2023 · 0 comments

Comments

@sobrinho
Copy link

Do you want to request a feature or report a bug?
Bug

What is the current behavior?
When the SDK resorts to XHR and the connection fails with status code 0 (such as being interrupted before contacting the server or being aborted), the error callback might be called with two structures:

Option A:

{"type":"WebSocketError","error":{"type":"PusherError","data":{"code":1006,"message":"Connection interrupted (undefined)"}}}

Option B:

{"type":"PusherError","data":{"code":1006,"message":"Connection interrupted (undefined)"}}

On both cases, I can see the breadcrumbs on my error tracking platform that the connection to Pusher failed with status 0:

Screen Shot 2023-07-26 at 10 57 36 Screen Shot 2023-07-26 at 10 57 04

To ignore the error, I had to implement my app like this to ignore the error:

if (error.data?.code === 1006 || error.error?.data?.code === 1006) {
  // ignore, 1006 is an unstable connection
  return
}

If the current behavior is a bug, please provide the steps to reproduce and
if possible a minimal demo of the problem via https://jsfiddle.net or similar.

Not easy to reproduce, needs an unstable internet connection such as mobile connections.

What is the expected behavior?

Always the same error structure.

Which versions of Pusher, and which browsers / OS are affected by this issue?
Did this work in previous versions of Pusher? If so, which?

8.0.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant