Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

pusher-js-auth

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pusher-js-auth - npm Package Compare versions

Comparing version 2.0.0 to 3.0.0

54

lib/pusher-auth.js

@@ -7,3 +7,16 @@ /**

*/
(function(Pusher){
(function (root, factory) {
if (typeof module === 'object' && module.exports) {
// Node. Does not work with strict CommonJS, but
// only CommonJS-like environments that support module.exports,
// like Node.
module.exports = factory(require('pusher-js'));
} else if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
define(['pusher-js'], factory);
} else {
// Browser globals (root is window)
root.PusherBatchAuthorizer = factory(root.Pusher);
}
}(typeof self !== 'undefined' ? self : this, function(Pusher){

@@ -137,22 +150,21 @@ /**

var authorizers = {};
var buffered = function buffered(Runtime, socketId, callback){
var authEndpoint = this.options.authEndpoint;
var key = socketId + ':' + authEndpoint;
var authorizer = authorizers[key];
if(!authorizer){
authorizer = authorizers[key] = new BufferedAuthorizer({
socketId: socketId,
authEndpoint: authEndpoint,
authDelay: this.options.authDelay,
authOptions: this.options.auth
});
return function (channel, options) {
return {
authorize: function (socketId, callback) {
var authEndpoint = options.authEndpoint;
var key = socketId + ':' + authEndpoint;
var authorizer = authorizers[key];
if(!authorizer){
authorizer = authorizers[key] = new BufferedAuthorizer({
socketId: socketId,
authEndpoint: authEndpoint,
authDelay: options.authDelay,
authOptions: options.auth
});
}
authorizer.add(channel.name, callback);
}
}
authorizer.add(this.channel.name, callback);
};
var supportedAuthorizers = Pusher.Runtime.getAuthorizers();
Pusher.Runtime.getAuthorizers = function(){
supportedAuthorizers.buffered = buffered;
return supportedAuthorizers;
};
})(window.Pusher);
}
}));
{
"name": "pusher-js-auth",
"version": "2.0.0",
"version": "3.0.0",
"license": "MIT",

@@ -5,0 +5,0 @@ "description": "Pusher plugin for batching auth requests in one HTTP call",

@@ -8,5 +8,5 @@ # Pusher plugin for authentication

This is a plugin for the official [Pusher](http://pusher.com) JavaScript library and compatible with the latest 3.1.x release. Make sure you have a working implementation up and running.
This is a plugin for the official [Pusher](http://pusher.com) JavaScript library and compatible with the latest 4.1.x release. Make sure you have a working implementation up and running.
**Notice:** This version is not compatibile with Pusher 3.0 and older. Please use version [1.2.0](https://github.com/dirkbonhomme/pusher-js-auth/releases) of this plugin with older Pusher versions.
**Notice:** This version is not compatible with Pusher 4.0 and older. Please use version [2.0.0](https://github.com/dirkbonhomme/pusher-js-auth/releases) of this plugin with older Pusher versions.

@@ -19,3 +19,3 @@ Documentation and configuration options are explained at the [Pusher-js Github page](https://github.com/pusher/pusher-js)

<script src="//js.pusher.com/3.0/pusher.min.js"></script>
<script src="//js.pusher.com/4.2/pusher.min.js"></script>
<script src="lib/pusher-auth.js"></script>

@@ -33,9 +33,9 @@

var pusher = new Pusher(API_KEY, {
authTransport: 'buffered',
authorizer: PusherBatchAuthorizer,
authDelay: 200
});
### `authTransport` (String)
### `authorizer` (Function)
Required field. Use "buffered" to enable this plugin.
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.

@@ -80,2 +80,2 @@ ### `authDelay` (Number)

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.
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.

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc