You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Pusher plugin for batching auth requests in one HTTP call.
When subscribing to multiple private- and presence channels at once, your browser has to make an HTTP request for each channel. This plugin enables you to process multiple channel authentications within one request.
Prerequisites
This is a plugin for the official Pusher JavaScript library and compatible with the latest 7.0.x release. Make sure you have a working implementation up and running.
Notice: This version is not compatible with Pusher 6.0 and older. Please use version 3.0 of this plugin with older Pusher versions.
This plugin comes with a few extra configuration parameters. The whole list is available at the Pusher-js Github page
var pusher = new Pusher(API_KEY, {
authorizer: PusherBatchAuthorizer,
authDelay: 200
});
authorizer (Function)
Pass the function exposed by this plugin here. It is exposed as a module export when using AMD or CommonJS, and as the PusherBatchAuthorizer global otherwise.
authDelay (Number)
Optional, defaults to 0. Delay in milliseconds before executing an authentication request. The value can be as low as 0 when subscribing to multiple channels within the same event loop. Please note that the first authentication request is postponed anyway until the connection to Pusher succeeds.
Server side authentication
Your authentication endpoint should be able to handle batched requests.
Copy app_key.example.js and app_key.example.php to app_key.example.xx and fill in your own Pusher data. Create a small PHP server and run index.html with your browser's debug console active.
About
Pusher plugin for batching auth requests in one HTTP call