Skip to content

Commit

Permalink
Release v3.2.3
Browse files Browse the repository at this point in the history
  • Loading branch information
hph committed Nov 22, 2016
1 parent 0bb37df commit 918b63c
Show file tree
Hide file tree
Showing 8 changed files with 66 additions and 19 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.markdown
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Changelog

## 3.2.3 (2016-10-22)

[NEW] Cancelled subscriptions are now re-instated on subsequent `subscribe`
calls, allowing arbitrary chains of `subscribe`/`unsubscribe` calls, where the
final method is always respected regardless of the timings.
See [PR 201](https://github.com/pusher/pusher-js/pull/201) for details.

## 3.2.2 (2016-10-03)

[FIXED] Fix unsubscribe behaviour while subscription is pending (thanks to @hot-leaf-juice).
Expand Down
16 changes: 13 additions & 3 deletions dist/node/pusher.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* Pusher JavaScript Library v3.2.2
* Pusher JavaScript Library v3.2.3
* http://pusher.com/
*
* Copyright 2016, Pusher
Expand Down Expand Up @@ -199,7 +199,10 @@ module.exports =
};
Pusher.prototype.subscribe = function (channel_name) {
var channel = this.channels.add(channel_name, this);
if (this.connection.state === "connected") {
if (channel.subscriptionPending && channel.subscriptionCancelled) {
channel.reinstateSubscription();
}
else if (!channel.subscriptionPending && this.connection.state === "connected") {
channel.subscribe();
}
return channel;
Expand Down Expand Up @@ -810,7 +813,7 @@ module.exports =

"use strict";
var Defaults = {
VERSION: "3.2.2",
VERSION: "3.2.3",
PROTOCOL: 7,
host: 'ws.pusherapp.com',
ws_port: 80,
Expand Down Expand Up @@ -2657,7 +2660,11 @@ module.exports =
};
Channel.prototype.subscribe = function () {
var _this = this;
if (this.subscribed) {
return;
}
this.subscriptionPending = true;
this.subscriptionCancelled = false;
this.authorize(this.pusher.connection.socket_id, function (error, data) {
if (error) {
_this.handleEvent('pusher:subscription_error', data);
Expand All @@ -2680,6 +2687,9 @@ module.exports =
Channel.prototype.cancelSubscription = function () {
this.subscriptionCancelled = true;
};
Channel.prototype.reinstateSubscription = function () {
this.subscriptionCancelled = false;
};
return Channel;
}(dispatcher_1["default"]));
exports.__esModule = true;
Expand Down
16 changes: 13 additions & 3 deletions dist/react-native/pusher.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* Pusher JavaScript Library v3.2.2
* Pusher JavaScript Library v3.2.3
* http://pusher.com/
*
* Copyright 2016, Pusher
Expand Down Expand Up @@ -199,7 +199,10 @@ module.exports =
};
Pusher.prototype.subscribe = function (channel_name) {
var channel = this.channels.add(channel_name, this);
if (this.connection.state === "connected") {
if (channel.subscriptionPending && channel.subscriptionCancelled) {
channel.reinstateSubscription();
}
else if (!channel.subscriptionPending && this.connection.state === "connected") {
channel.subscribe();
}
return channel;
Expand Down Expand Up @@ -808,7 +811,7 @@ module.exports =

"use strict";
var Defaults = {
VERSION: "3.2.2",
VERSION: "3.2.3",
PROTOCOL: 7,
host: 'ws.pusherapp.com',
ws_port: 80,
Expand Down Expand Up @@ -2670,7 +2673,11 @@ module.exports =
};
Channel.prototype.subscribe = function () {
var _this = this;
if (this.subscribed) {
return;
}
this.subscriptionPending = true;
this.subscriptionCancelled = false;
this.authorize(this.pusher.connection.socket_id, function (error, data) {
if (error) {
_this.handleEvent('pusher:subscription_error', data);
Expand All @@ -2693,6 +2700,9 @@ module.exports =
Channel.prototype.cancelSubscription = function () {
this.subscriptionCancelled = true;
};
Channel.prototype.reinstateSubscription = function () {
this.subscriptionCancelled = false;
};
return Channel;
}(dispatcher_1["default"]));
exports.__esModule = true;
Expand Down
16 changes: 13 additions & 3 deletions dist/web/pusher.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* Pusher JavaScript Library v3.2.2
* Pusher JavaScript Library v3.2.3
* http://pusher.com/
*
* Copyright 2016, Pusher
Expand Down Expand Up @@ -208,7 +208,10 @@ return /******/ (function(modules) { // webpackBootstrap
};
Pusher.prototype.subscribe = function (channel_name) {
var channel = this.channels.add(channel_name, this);
if (this.connection.state === "connected") {
if (channel.subscriptionPending && channel.subscriptionCancelled) {
channel.reinstateSubscription();
}
else if (!channel.subscriptionPending && this.connection.state === "connected") {
channel.subscribe();
}
return channel;
Expand Down Expand Up @@ -457,7 +460,7 @@ return /******/ (function(modules) { // webpackBootstrap

"use strict";
var Defaults = {
VERSION: "3.2.2",
VERSION: "3.2.3",
PROTOCOL: 7,
host: 'ws.pusherapp.com',
ws_port: 80,
Expand Down Expand Up @@ -3149,7 +3152,11 @@ return /******/ (function(modules) { // webpackBootstrap
};
Channel.prototype.subscribe = function () {
var _this = this;
if (this.subscribed) {
return;
}
this.subscriptionPending = true;
this.subscriptionCancelled = false;
this.authorize(this.pusher.connection.socket_id, function (error, data) {
if (error) {
_this.handleEvent('pusher:subscription_error', data);
Expand All @@ -3172,6 +3179,9 @@ return /******/ (function(modules) { // webpackBootstrap
Channel.prototype.cancelSubscription = function () {
this.subscriptionCancelled = true;
};
Channel.prototype.reinstateSubscription = function () {
this.subscriptionCancelled = false;
};
return Channel;
}(dispatcher_1["default"]));
exports.__esModule = true;
Expand Down
6 changes: 3 additions & 3 deletions dist/web/pusher.min.js

Large diffs are not rendered by default.

16 changes: 13 additions & 3 deletions dist/worker/pusher.worker.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* Pusher JavaScript Library v3.2.2
* Pusher JavaScript Library v3.2.3
* http://pusher.com/
*
* Copyright 2016, Pusher
Expand Down Expand Up @@ -199,7 +199,10 @@ var Pusher =
};
Pusher.prototype.subscribe = function (channel_name) {
var channel = this.channels.add(channel_name, this);
if (this.connection.state === "connected") {
if (channel.subscriptionPending && channel.subscriptionCancelled) {
channel.reinstateSubscription();
}
else if (!channel.subscriptionPending && this.connection.state === "connected") {
channel.subscribe();
}
return channel;
Expand Down Expand Up @@ -808,7 +811,7 @@ var Pusher =

"use strict";
var Defaults = {
VERSION: "3.2.2",
VERSION: "3.2.3",
PROTOCOL: 7,
host: 'ws.pusherapp.com',
ws_port: 80,
Expand Down Expand Up @@ -2637,7 +2640,11 @@ var Pusher =
};
Channel.prototype.subscribe = function () {
var _this = this;
if (this.subscribed) {
return;
}
this.subscriptionPending = true;
this.subscriptionCancelled = false;
this.authorize(this.pusher.connection.socket_id, function (error, data) {
if (error) {
_this.handleEvent('pusher:subscription_error', data);
Expand All @@ -2660,6 +2667,9 @@ var Pusher =
Channel.prototype.cancelSubscription = function () {
this.subscriptionCancelled = true;
};
Channel.prototype.reinstateSubscription = function () {
this.subscriptionCancelled = false;
};
return Channel;
}(dispatcher_1["default"]));
exports.__esModule = true;
Expand Down
6 changes: 3 additions & 3 deletions dist/worker/pusher.worker.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "pusher-js",
"version": "3.2.2",
"version": "3.2.3",
"description": "Pusher JavaScript library for browser, React Native, NodeJS and web workers",
"main": "dist/web/pusher.js",
"scripts": {
Expand Down

0 comments on commit 918b63c

Please sign in to comment.