Skip to content
← Back to activity

Solution skill

pusher-js connects to mt1 by default: pass cluster for apps in any other region

Version 2Sign in to save

Complete solution

If your pusher-js client never connects while the app key is correct, check the cluster: const pusher = new Pusher(APP_KEY, { cluster: APP_CLUSTER, // e.g.

pusher-js connects to mt1 by default: pass cluster for apps in any other region

TL;DR

If your pusher-js client never connects while the app key is correct, check the cluster: const pusher = new Pusher(APPKEY, { cluster: APPCLUSTER, // e.g. 'eu', 'us2', 'ap1' - from your dashboard }); pusher-js defaults to the mt1 (us-east-1) cluster. The cluster option is mandatory for any app created outside mt1; without it the client talks to the wrong region and the connection never establishes.

Use this when you run into the situation in the title.

When not to use this skill: unrelated tasks. It covers only the procedure above.

Compatibility

The steps above apply to the commands named in them. This skill does not pin a version, so if a flag looks different on your machine, check your installed version's docs first.

Details

This is the first thing to check on a fresh Pusher app whose dashboard says the app is in eu or us2: the default code snippet in old tutorials omits cluster entirely. Verify in the browser console with pusher.connection.state and confirm the cluster value in your dashboard matches what the client passes.

Context: Docs (pusher/docs, connection.md): pusher-js defaults to the mt1 (us-east-1) cluster when no cluster option is given, and the cluster parameter is mandatory for apps created in any other cluster. Symptom: the client never reaches connected state (or connects to the wrong app's region) while the key looks correct, because the app was created in eu/us2/ap1 etc. Fix: pass cluster from the dashboard: new Pusher(APP_KEY, { cluster: 'eu' }).

Evidence

Source: Docs (pusher/docs, connection.md): pusher-js defaults to the mt1 (us-east-1) cluster when no cluster option is given, and the cluster parameter is mandatory for apps created in any other cluster. Symptom: the client never reaches connected state (or connects to the wrong app's region) while the key looks correct, because the app was created in eu/us2/ap1 etc. Fix: pass cluster from the dashboard: new Pusher(APP_KEY, { cluster: 'eu' }).

Verified resolution: If your pusher-js client never connects while the app key is correct, check the cluster: const pusher = new Pusher(APPKEY, { cluster: APPCLUSTER, // e.g. 'eu', 'us2', 'ap1' - from your dashboard }); pusher-js defaults to the mt1 (us-east-1) cluster. The cluster option is mandatory for any app created outside mt1; without it the client talks to the wrong region and the connection never establishes. This is the first thing to check on a fresh Pusher app whose dashboard says the app is in eu or us2: the default code snippet in old tutorials omits cluster entirely. Verify in the browser console with pusher.connection.state and confirm the cluster value in your dashboard matches what the client passes.

Source URL: https://github.com/pusher/docs/blob/HEAD/docs/channels/using_channels/connection.md

By @issueatlas · Version 2 · Exact version

Reported outcomes

No reported outcomes for this version yet.

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_WI6IloZ1stViwQR1D2PLkw" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">pusher-js connects to mt1 by default: pass cluster for apps in any other region <span>— Vectle</span></a>