pusher-js 7.1.1-beta → 7.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 7.2.0
4
+
5
+ * [ADDED] Add support for subscription_count event
6
+
3
7
  ## 7.1.1-beta
4
8
 
5
9
  [FIXED] Exported Typescript types in index.d.ts
package/README.md CHANGED
@@ -225,7 +225,9 @@ There are a number of configuration parameters which can be set for the client,
225
225
  ```js
226
226
  const pusher = new Pusher(APP_KEY, {
227
227
  cluster: APP_CLUSTER,
228
- authEndpoint: 'http://example.com/pusher/auth'
228
+ channelAuthorization: {
229
+ endpoint: 'http://example.com/pusher/auth'
230
+ },
229
231
  });
230
232
  ```
231
233
 
@@ -463,7 +465,7 @@ It is possible to access all subscribed channels through the `allChannels` funct
463
465
  pusher.allChannels().forEach(channel => console.log(channel.name));
464
466
  ```
465
467
 
466
- Private, presence and encrypted channels will make a request to your `authEndpoint` (`/pusher/auth`) by default, where you will have to [authenticate the subscription](https://pusher.com/docs/authenticating_users). You will have to send back the correct auth response and a 200 status code.
468
+ Private, presence and encrypted channels will make a request to your `channelAuthorization.endpoint` (`/pusher/auth`) by default, where you will have to [authorize the subscription](https://pusher.com/docs/authorizing_users). You will have to send back the correct authorization response and a 200 status code.
467
469
 
468
470
  ## Unsubscribing from channels
469
471
 
@@ -564,9 +566,9 @@ channel.trigger('client-my-event', {message: 'Hello, world!'})
564
566
  ```
565
567
 
566
568
 
567
- ## Batching auth requests (aka multi-auth)
569
+ ## Batching authorization requests (aka multi-authorization)
568
570
 
569
- Currently, pusher-js itself does not support authenticating multiple channels in one HTTP request. However, thanks to @dirkbonhomme you can use the [pusher-js-auth](https://github.com/dirkbonhomme/pusher-js-auth) plugin that buffers subscription requests and sends auth requests to your endpoint in batches.
571
+ Currently, pusher-js itself does not support authorizing multiple channels in one HTTP request. However, thanks to @dirkbonhomme you can use the [pusher-js-auth](https://github.com/dirkbonhomme/pusher-js-auth) plugin that buffers subscription requests and sends authorization requests to your endpoint in batches.
570
572
 
571
573
  ## Default events
572
574
 
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Pusher JavaScript Library v7.1.1-beta
2
+ * Pusher JavaScript Library v7.2.0
3
3
  * https://pusher.com/
4
4
  *
5
5
  * Copyright 2020, Pusher
@@ -7487,7 +7487,7 @@ function safeJSONStringify(source) {
7487
7487
 
7488
7488
  // CONCATENATED MODULE: ./src/core/defaults.ts
7489
7489
  var Defaults = {
7490
- VERSION: "7.1.1-beta",
7490
+ VERSION: "7.2.0",
7491
7491
  PROTOCOL: 7,
7492
7492
  wsPort: 80,
7493
7493
  wssPort: 443,
@@ -8517,6 +8517,9 @@ var channel_Channel = (function (_super) {
8517
8517
  if (eventName === 'pusher_internal:subscription_succeeded') {
8518
8518
  this.handleSubscriptionSucceededEvent(event);
8519
8519
  }
8520
+ else if (eventName === 'pusher_internal:subscription_count') {
8521
+ this.handleSubscriptionCountEvent(event);
8522
+ }
8520
8523
  else if (eventName.indexOf('pusher_internal:') !== 0) {
8521
8524
  var metadata = {};
8522
8525
  this.emit(eventName, data, metadata);
@@ -8532,6 +8535,12 @@ var channel_Channel = (function (_super) {
8532
8535
  this.emit('pusher:subscription_succeeded', event.data);
8533
8536
  }
8534
8537
  };
8538
+ Channel.prototype.handleSubscriptionCountEvent = function (event) {
8539
+ if (event.data.subscription_count) {
8540
+ this.subscriptionCount = event.data.subscription_count;
8541
+ }
8542
+ this.emit('pusher:subscription_count', event.data);
8543
+ };
8535
8544
  Channel.prototype.subscribe = function () {
8536
8545
  var _this = this;
8537
8546
  if (this.subscribed) {
@@ -8723,6 +8732,9 @@ var presence_channel_PresenceChannel = (function (_super) {
8723
8732
  case 'pusher_internal:subscription_succeeded':
8724
8733
  this.handleSubscriptionSucceededEvent(event);
8725
8734
  break;
8735
+ case 'pusher_internal:subscription_count':
8736
+ this.handleSubscriptionCountEvent(event);
8737
+ break;
8726
8738
  case 'pusher_internal:member_added':
8727
8739
  var addedMember = this.members.addMember(data);
8728
8740
  this.emit('pusher:member_added', addedMember);