# What Is Meant By Channels Error 1006?

When a WebSocket connection is closed without a "close frame", the pusher-js library emits an error with code 1006. Usually this is caused by WebSocket-incompatible proxies, which can't close the connection in the correct way.

See: <https://developer.mozilla.org/en-US/docs/WebSockets/WebSockets_reference>

**How does pusher-js deal with such scenarios?**

Pusher's JavaScript client uses two strategies to maintain a working connection.

*Lower the heartbeat interval*

A "Heartbeat" is a small message that is exchanged by clients and servers to check whether connections are still open and working.

Some proxies might terminate connections because there isn't any data sent in either direction. To counteract such behaviour, after getting an 1006 close code, the heartbeat interval is lowered to half the lifespan of the last connection (minimum 10s, maximum 120s).

This way, connections are kept active all the time and proxies might stop disconnecting them.

*Disable WebSockets*

When pusher-js detects that two WebSocket connections failed after less than a few minutes, it decides to disable WebSocket-based transports (including Flash) and fall back to HTTP. This way clients won't waste any more time trying to use a broken transport. Additionally, pusher-js remembers last successful transport, so after refreshing the page, it will jump straight to the HTTP fallback.

{% hint style="info" %}
Still have questions? Please reach out to our Support team by visiting [this page](https://messagebird.com/support-center/Pusher-request-new).
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.bird.com/pusher/channels/channels/troubleshooting/what-is-meant-by-channels-error-1006.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
