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 +4 -0
- package/README.md +6 -4
- package/dist/node/pusher.js +14 -2
- package/dist/node/pusher.js.map +1 -1
- package/dist/react-native/pusher.js +2 -2
- package/dist/react-native/pusher.js.map +1 -1
- package/dist/web/pusher-with-encryption.js +14 -2
- package/dist/web/pusher-with-encryption.js.map +1 -1
- package/dist/web/pusher-with-encryption.min.js +2 -2
- package/dist/web/pusher-with-encryption.min.js.map +1 -1
- package/dist/web/pusher.js +14 -2
- package/dist/web/pusher.js.map +1 -1
- package/dist/web/pusher.min.js +2 -2
- package/dist/web/pusher.min.js.map +1 -1
- package/dist/worker/pusher-with-encryption.worker.js +14 -2
- package/dist/worker/pusher-with-encryption.worker.js.map +1 -1
- package/dist/worker/pusher-with-encryption.worker.min.js +2 -2
- package/dist/worker/pusher-with-encryption.worker.min.js.map +1 -1
- package/dist/worker/pusher.worker.js +14 -2
- package/dist/worker/pusher.worker.js.map +1 -1
- package/dist/worker/pusher.worker.min.js +2 -2
- package/dist/worker/pusher.worker.min.js.map +1 -1
- package/package.json +1 -1
- package/spec/javascripts/unit/core/channels/channel_spec.js +25 -0
- package/src/core/channels/channel.ts +11 -0
- package/src/core/channels/presence_channel.ts +3 -0
- package/types/src/core/channels/channel.d.ts +2 -0
- package/worker/with-encryption/index.js +1 -1
package/CHANGELOG.md
CHANGED
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
|
-
|
|
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 `
|
|
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
|
|
569
|
+
## Batching authorization requests (aka multi-authorization)
|
|
568
570
|
|
|
569
|
-
Currently, pusher-js itself does not support
|
|
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
|
|
package/dist/node/pusher.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Pusher JavaScript Library v7.
|
|
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.
|
|
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);
|