Registry / http-networking / helpscout-pusher-js-auth

helpscout-pusher-js-auth

JSON →
library0.0.2jsnpmunverified

A plugin for the Pusher JavaScript library (v4.1.x) that batches multiple private and presence channel authentication requests into a single HTTP call. Version 0.0.2 is the latest stable release, with low release cadence. It reduces network overhead when subscribing to many channels simultaneously by aggregating auth requests into one POST. Key differentiator: enables batch authentication endpoint (not available in Pusher's default authorizer). Requires Pusher JS 4.1+ and a server endpoint that handles batched requests.

npm install helpscout-pusher-js-auth
INSTALL
IMPORT
SIG · HELPSCOUT-PUSHER-J
H
helpscout-pusher-js-auth
http-networkingjavascriptv0.0.2
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

PusherBatchAuthorizer
import PusherBatchAuthorizer from 'pusher-js-auth';
const PusherBatchAuthorizer = require('pusher-js-auth');
ESM default import; CJS require also works but is not recommended for bundlers. The global variable is 'PusherBatchAuthorizer' when using script tags.
PusherBatchAuthorizer
const PusherBatchAuthorizer = require('pusher-js-auth');
import { PusherBatchAuthorizer } from 'pusher-js-auth';
CJS require; named import is incorrect because the package exports a single default.
PusherBatchAuthorizer
<script src="lib/pusher-auth.js"></script>
<script src="node_modules/pusher-js-auth/dist/pusher-auth.js"></script>
Script tag usage: the plugin exposes 'PusherBatchAuthorizer' globally. Node_modules path is fragile; use the provided lib file after building.

Initializes Pusher with batch authorizer, subscribes to multiple channels to demonstrate single auth request.

import Pusher from 'pusher-js'; import PusherBatchAuthorizer from 'pusher-js-auth'; const pusher = new Pusher('YOUR_APP_KEY', { cluster: 'us2', authorizer: PusherBatchAuthorizer, authDelay: 200, authEndpoint: 'https://example.com/pusher/auth', }); const channel1 = pusher.subscribe('private-channel-1'); const channel2 = pusher.subscribe('presence-channel-2'); channel1.bind('pusher:subscription_succeeded', () => { console.log('Subscribed to channel1'); }); channel2.bind('pusher:subscription_succeeded', () => { console.log('Subscribed to channel2'); }); // The plugin will batch both auth requests into a single HTTP call.
Debug
Known issues
breakingVersion 0.0.2 is only compatible with Pusher 4.1.x and above. Using older Pusher versions will cause issues.
fix
Use version 2.0.0 of this plugin for Pusher 4.0 and older, or upgrade Pusher to >=4.1.0.
affects: >=0.0.0
gotchaThe server endpoint must handle batched requests. If it expects single channel auth, batch subscriptions will fail.
fix
Implement a batched auth endpoint that accepts multiple channel_name[] parameters and returns a JSON object per channel.
affects: >=0.0.0
gotchaauthDelay defaults to 0; if subscriptions are triggered in separate ticks, multiple requests may still occur. Increase delay to batch across ticks.
fix
Set authDelay to a value like 200ms to accumulate subscriptions from different ticks into a single request.
affects: >=0.0.0
deprecatedPackage is on npm as 'helpscout-pusher-js-auth' but the plugin's original repository is 'pusher-js-auth'. The npm package may be a fork.
fix
Consider using the original 'pusher-js-auth' package from npm for better community support.
affects: >=0.0.0
Errors
Common errors & fixes
Uncaught TypeError: pusher.subscribe is not a function
Pusher library not loaded before the plugin or incorrect initialization.
fix
Ensure pusher-js is loaded and initialized (e.g., import Pusher from 'pusher-js') before using the plugin.
PusherBatchAuthorizer is not defined
Plugin script not loaded or incorrect import path.
fix
If using script tags, include pusher-auth.js after pusher.min.js. If using npm, ensure the package is installed and imported correctly.
Server returned invalid auth response
The batched auth endpoint returned an unexpected JSON format.
fix
Ensure the server returns a JSON object with channel names as keys, each containing status and data fields as documented.
Upgrade
Version history
0.0.2latest on npm
Audit
Dependencies
pusher-jsrequiredPeer dependency; plugin is an authorizer for Pusher JS library, requires version 4.1.x
Agent activity
17 hits · last 30 days
node
16
OpenAI (training)
1
Resources
helpscout-pusher-js-auth — npm install helpscout-pusher-js-auth · libregistry