Skip to content

Commit

Permalink
Release version 4.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
hph committed Sep 28, 2017
1 parent 9de0a35 commit 1b32a3a
Show file tree
Hide file tree
Showing 9 changed files with 108 additions and 96 deletions.
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
# Changelog

## 4.2.0 (2017-09-28)

[FIXED] Fixed an issue where pusher-js would not attempt to subscribe to
channels that were in the process of being subscribed to when the connection
failed.

[FIXED] Does not attempt to call `handlesActivityChecks` on an undefined
connection instance anymore. Fixes issues #82 and #233.

[NEW] More helpful logging (

[CHANGED] Various improvements in README.md.

Many thanks to @hengwoon, @leesio, @juliangruber and Heng for their
contributions to this release!

## 4.1.0 (2017-04-20)

[NEW] Enable custom authorizers. For more information,
Expand Down
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ const Pusher = require('pusher-js');
#### CDN

```html
<script src="https://js.pusher.com/4.1/pusher.min.js"></script>
<script src="https://js.pusher.com/4.2/pusher.min.js"></script>
```

You can also use [cdnjs.com](https://cdnjs.com/libraries/pusher) if you prefer
Expand Down Expand Up @@ -99,7 +99,7 @@ Notes:
You can import the worker script (`pusher.worker.js`, not `pusher.js`) from the CDN:

```javascript
importScripts('https://js.pusher.com/4.1/pusher.worker.min.js');
importScripts('https://js.pusher.com/4.2/pusher.worker.min.js');
```

### Node.js
Expand Down Expand Up @@ -445,17 +445,17 @@ First, clone this repository and run `npm install && git submodule init && git s

In the `dist/web` folder, you should see the files you need: `pusher.js`, `pusher.min.js`, `json2.js`, `json.min.js`, `sockjs.js` and `sockjs.min.js`. `pusher.js` should be built referencing your URLs as the dependency hosts.

First, make sure you expose all files from the `dist` directory. They need to be in a directory with named after the version number. For example, if you're hosting version 4.1.0 under `http://example.com/pusher-js` (and https for SSL), files should be accessible under following URL's:
First, make sure you expose all files from the `dist` directory. They need to be in a directory with named after the version number. For example, if you're hosting version 4.2.0 under `http://example.com/pusher-js` (and https for SSL), files should be accessible under following URL's:

http://example.com/pusher-js/4.1.0/pusher.js
http://example.com/pusher-js/4.1.0/json2.js
http://example.com/pusher-js/4.1.0/sockjs.js
http://example.com/pusher-js/4.2.0/pusher.js
http://example.com/pusher-js/4.2.0/json2.js
http://example.com/pusher-js/4.2.0/sockjs.js

Minified files should have `.min` in their names, as in the `dist/web` directory:

http://example.com/pusher-js/4.1.0/pusher.min.js
http://example.com/pusher-js/4.1.0/json2.min.js
http://example.com/pusher-js/4.1.0/sockjs.min.js
http://example.com/pusher-js/4.2.0/pusher.min.js
http://example.com/pusher-js/4.2.0/json2.min.js
http://example.com/pusher-js/4.2.0/sockjs.min.js

## SockJS compatibility

Expand Down
41 changes: 20 additions & 21 deletions dist/node/pusher.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ module.exports =
checkAppKey(app_key);
options = options || {};
if (!options.cluster) {
var suffix = url_store_1["default"].buildLogSuffix("javascript_quick_start");
var suffix = url_store_1["default"].buildLogSuffix("javascriptQuickStart");
logger_1["default"].warn("You should always specify a cluster when connecting. " + suffix);
}
this.key = app_key;
Expand Down Expand Up @@ -1760,8 +1760,8 @@ module.exports =
}
}
else {
var suffix = url_store_1["default"].buildLogSuffix("authentication_endpoint");
logger_1["default"].warn(("Couldn't retrieve authentication info. " + status) +
var suffix = url_store_1["default"].buildLogSuffix("authenticationEndpoint");
logger_1["default"].warn(("Couldn't retrieve authentication info. " + xhr.status) +
("Clients must be authenticated to join private or presence channels. " + suffix));
callback(true, xhr.status);
}
Expand All @@ -1779,32 +1779,32 @@ module.exports =
/***/ (function(module, exports) {

"use strict";
var url_store = {
base_url: "https://pusher.com",
var urlStore = {
baseUrl: "https://pusher.com",
urls: {
authentication_endpoint: {
authenticationEndpoint: {
path: "/docs/authenticating_users"
},
javascript_quick_start: {
javascriptQuickStart: {
path: "/docs/javascript_quick_start"
}
}
};
var buildLogSuffix = function (key) {
var url_prefix = "Check out:";
var url_obj = url_store.urls[key];
if (!url_obj)
var urlPrefix = "See:";
var urlObj = urlStore.urls[key];
if (!urlObj)
return "";
var url;
if (url_obj.full_url) {
url = url_obj.full_url;
if (urlObj.fullUrl) {
url = urlObj.fullUrl;
}
else if (url_obj.path) {
url = url_store.base_url + url_obj.path;
else if (urlObj.path) {
url = urlStore.baseUrl + urlObj.path;
}
if (!url)
return "";
return [url_prefix, url].join(" ");
return urlPrefix + " " + url;
};
exports.__esModule = true;
exports["default"] = { buildLogSuffix: buildLogSuffix };
Expand Down Expand Up @@ -2597,11 +2597,9 @@ module.exports =
_super.prototype.authorize.call(this, socketId, function (error, authData) {
if (!error) {
if (authData.channel_data === undefined) {
var suffix = url_store_1["default"].buildLogSuffix("authentication_endpoint");
logger_1["default"].warn("Invalid auth response for channel '" +
_this.name +
"', expected 'channel_data' field." +
suffix);
var suffix = url_store_1["default"].buildLogSuffix("authenticationEndpoint");
logger_1["default"].warn(("Invalid auth response for channel '" + _this.name + "',") +
("expected 'channel_data' field. " + suffix));
callback("Invalid auth response");
return;
}
Expand Down Expand Up @@ -2711,6 +2709,7 @@ module.exports =
};
Channel.prototype.disconnect = function () {
this.subscribed = false;
this.subscriptionPending = false;
};
Channel.prototype.handleEvent = function (event, data) {
if (event.indexOf("pusher_internal:") === 0) {
Expand Down Expand Up @@ -3063,7 +3062,7 @@ module.exports =
ConnectionManager.prototype.resetActivityCheck = function () {
var _this = this;
this.stopActivityCheck();
if (!this.connection.handlesActivityChecks()) {
if (this.connection && !this.connection.handlesActivityChecks()) {
this.activityTimer = new timers_1.OneOffTimer(this.activityTimeout, function () {
_this.sendActivityCheck();
});
Expand Down
41 changes: 20 additions & 21 deletions dist/react-native/pusher.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ module.exports =
checkAppKey(app_key);
options = options || {};
if (!options.cluster) {
var suffix = url_store_1["default"].buildLogSuffix("javascript_quick_start");
var suffix = url_store_1["default"].buildLogSuffix("javascriptQuickStart");
logger_1["default"].warn("You should always specify a cluster when connecting. " + suffix);
}
this.key = app_key;
Expand Down Expand Up @@ -1773,8 +1773,8 @@ module.exports =
}
}
else {
var suffix = url_store_1["default"].buildLogSuffix("authentication_endpoint");
logger_1["default"].warn(("Couldn't retrieve authentication info. " + status) +
var suffix = url_store_1["default"].buildLogSuffix("authenticationEndpoint");
logger_1["default"].warn(("Couldn't retrieve authentication info. " + xhr.status) +
("Clients must be authenticated to join private or presence channels. " + suffix));
callback(true, xhr.status);
}
Expand All @@ -1792,32 +1792,32 @@ module.exports =
/***/ (function(module, exports) {

"use strict";
var url_store = {
base_url: "https://pusher.com",
var urlStore = {
baseUrl: "https://pusher.com",
urls: {
authentication_endpoint: {
authenticationEndpoint: {
path: "/docs/authenticating_users"
},
javascript_quick_start: {
javascriptQuickStart: {
path: "/docs/javascript_quick_start"
}
}
};
var buildLogSuffix = function (key) {
var url_prefix = "Check out:";
var url_obj = url_store.urls[key];
if (!url_obj)
var urlPrefix = "See:";
var urlObj = urlStore.urls[key];
if (!urlObj)
return "";
var url;
if (url_obj.full_url) {
url = url_obj.full_url;
if (urlObj.fullUrl) {
url = urlObj.fullUrl;
}
else if (url_obj.path) {
url = url_store.base_url + url_obj.path;
else if (urlObj.path) {
url = urlStore.baseUrl + urlObj.path;
}
if (!url)
return "";
return [url_prefix, url].join(" ");
return urlPrefix + " " + url;
};
exports.__esModule = true;
exports["default"] = { buildLogSuffix: buildLogSuffix };
Expand Down Expand Up @@ -2610,11 +2610,9 @@ module.exports =
_super.prototype.authorize.call(this, socketId, function (error, authData) {
if (!error) {
if (authData.channel_data === undefined) {
var suffix = url_store_1["default"].buildLogSuffix("authentication_endpoint");
logger_1["default"].warn("Invalid auth response for channel '" +
_this.name +
"', expected 'channel_data' field." +
suffix);
var suffix = url_store_1["default"].buildLogSuffix("authenticationEndpoint");
logger_1["default"].warn(("Invalid auth response for channel '" + _this.name + "',") +
("expected 'channel_data' field. " + suffix));
callback("Invalid auth response");
return;
}
Expand Down Expand Up @@ -2724,6 +2722,7 @@ module.exports =
};
Channel.prototype.disconnect = function () {
this.subscribed = false;
this.subscriptionPending = false;
};
Channel.prototype.handleEvent = function (event, data) {
if (event.indexOf("pusher_internal:") === 0) {
Expand Down Expand Up @@ -3076,7 +3075,7 @@ module.exports =
ConnectionManager.prototype.resetActivityCheck = function () {
var _this = this;
this.stopActivityCheck();
if (!this.connection.handlesActivityChecks()) {
if (this.connection && !this.connection.handlesActivityChecks()) {
this.activityTimer = new timers_1.OneOffTimer(this.activityTimeout, function () {
_this.sendActivityCheck();
});
Expand Down
41 changes: 20 additions & 21 deletions dist/web/pusher.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ return /******/ (function(modules) { // webpackBootstrap
checkAppKey(app_key);
options = options || {};
if (!options.cluster) {
var suffix = url_store_1["default"].buildLogSuffix("javascript_quick_start");
var suffix = url_store_1["default"].buildLogSuffix("javascriptQuickStart");
logger_1["default"].warn("You should always specify a cluster when connecting. " + suffix);
}
this.key = app_key;
Expand Down Expand Up @@ -591,8 +591,8 @@ return /******/ (function(modules) { // webpackBootstrap
}
}
else {
var suffix = url_store_1["default"].buildLogSuffix("authentication_endpoint");
logger_1["default"].warn(("Couldn't retrieve authentication info. " + status) +
var suffix = url_store_1["default"].buildLogSuffix("authenticationEndpoint");
logger_1["default"].warn(("Couldn't retrieve authentication info. " + xhr.status) +
("Clients must be authenticated to join private or presence channels. " + suffix));
callback(true, xhr.status);
}
Expand Down Expand Up @@ -1017,32 +1017,32 @@ return /******/ (function(modules) { // webpackBootstrap
/***/ (function(module, exports) {

"use strict";
var url_store = {
base_url: "https://pusher.com",
var urlStore = {
baseUrl: "https://pusher.com",
urls: {
authentication_endpoint: {
authenticationEndpoint: {
path: "/docs/authenticating_users"
},
javascript_quick_start: {
javascriptQuickStart: {
path: "/docs/javascript_quick_start"
}
}
};
var buildLogSuffix = function (key) {
var url_prefix = "Check out:";
var url_obj = url_store.urls[key];
if (!url_obj)
var urlPrefix = "See:";
var urlObj = urlStore.urls[key];
if (!urlObj)
return "";
var url;
if (url_obj.full_url) {
url = url_obj.full_url;
if (urlObj.fullUrl) {
url = urlObj.fullUrl;
}
else if (url_obj.path) {
url = url_store.base_url + url_obj.path;
else if (urlObj.path) {
url = urlStore.baseUrl + urlObj.path;
}
if (!url)
return "";
return [url_prefix, url].join(" ");
return urlPrefix + " " + url;
};
exports.__esModule = true;
exports["default"] = { buildLogSuffix: buildLogSuffix };
Expand Down Expand Up @@ -3089,11 +3089,9 @@ return /******/ (function(modules) { // webpackBootstrap
_super.prototype.authorize.call(this, socketId, function (error, authData) {
if (!error) {
if (authData.channel_data === undefined) {
var suffix = url_store_1["default"].buildLogSuffix("authentication_endpoint");
logger_1["default"].warn("Invalid auth response for channel '" +
_this.name +
"', expected 'channel_data' field." +
suffix);
var suffix = url_store_1["default"].buildLogSuffix("authenticationEndpoint");
logger_1["default"].warn(("Invalid auth response for channel '" + _this.name + "',") +
("expected 'channel_data' field. " + suffix));
callback("Invalid auth response");
return;
}
Expand Down Expand Up @@ -3203,6 +3201,7 @@ return /******/ (function(modules) { // webpackBootstrap
};
Channel.prototype.disconnect = function () {
this.subscribed = false;
this.subscriptionPending = false;
};
Channel.prototype.handleEvent = function (event, data) {
if (event.indexOf("pusher_internal:") === 0) {
Expand Down Expand Up @@ -3495,7 +3494,7 @@ return /******/ (function(modules) { // webpackBootstrap
ConnectionManager.prototype.resetActivityCheck = function () {
var _this = this;
this.stopActivityCheck();
if (!this.connection.handlesActivityChecks()) {
if (this.connection && !this.connection.handlesActivityChecks()) {
this.activityTimer = new timers_1.OneOffTimer(this.activityTimeout, function () {
_this.sendActivityCheck();
});
Expand Down
4 changes: 2 additions & 2 deletions dist/web/pusher.min.js

Large diffs are not rendered by default.

Loading

0 comments on commit 1b32a3a

Please sign in to comment.