Skip to content

Commit

Permalink
Merge de37543 into ed900f8
Browse files Browse the repository at this point in the history
  • Loading branch information
MeenaAlfons authored Nov 29, 2023
2 parents ed900f8 + de37543 commit 401bf2b
Show file tree
Hide file tree
Showing 34 changed files with 257 additions and 58 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
on:
push:
branches: [ master ]
pull_request:
types: [ labeled ]
branches:
- master

jobs:
check-release-tag:
if: ${{ github.head_ref == 'master' || github.event.label.name == 'deploy-release' }}
runs-on: ubuntu-latest
steps:
- name: Checkout code
Expand Down
42 changes: 23 additions & 19 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,29 +1,33 @@
# Changelog

## 8.3.0

# Changelog

## 8.4.0-rc1

- [Added] Introduce a new method to switch the Pusher client to a different cluster and re-establish all existing subscriptions and channel bindings.

## 8.3.0

- [CHANGED] Update cached re-connect strategy to prioritize WebSocket

## 8.2.0


## 8.2.0

- [CHANGED] Remove WebSocket retry limit.

## 8.1.0


## 8.1.0

- [CHANGED] Move @types dependencies to devDependencies
- [CHANGED] Upgrade typescript to 5.1.3

## 8.0.2


## 8.0.2

- [CHANGED] Fix React Native support.

## 8.0.1


## 8.0.1

- [FIXED] Fix 'window is not defined' error in the worker context
- [FIXED] Specify the right status when an error is thrown for the pusher worker instance

## 8.0.0


## 8.0.0

- [CHANGED] Specifying a cluster when instantiating the Pusher object is now mandatory. An exception is thrown if the cluster setting is missing.

## 7.6.0
Expand Down
16 changes: 14 additions & 2 deletions dist/node/pusher.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/node/pusher.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/react-native/pusher.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/react-native/pusher.js.map

Large diffs are not rendered by default.

16 changes: 14 additions & 2 deletions dist/web/pusher-with-encryption.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/web/pusher-with-encryption.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/web/pusher-with-encryption.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/web/pusher-with-encryption.min.js.map

Large diffs are not rendered by default.

16 changes: 14 additions & 2 deletions dist/web/pusher.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/web/pusher.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/web/pusher.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/web/pusher.min.js.map

Large diffs are not rendered by default.

16 changes: 14 additions & 2 deletions dist/worker/pusher-with-encryption.worker.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/worker/pusher-with-encryption.worker.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/worker/pusher-with-encryption.worker.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/worker/pusher-with-encryption.worker.min.js.map

Large diffs are not rendered by default.

16 changes: 14 additions & 2 deletions dist/worker/pusher.worker.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/worker/pusher.worker.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/worker/pusher.worker.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/worker/pusher.worker.min.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

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": "8.3.0",
"version": "8.4.0-rc1",
"description": "Pusher Channels JavaScript library for browsers, React Native, NodeJS and web workers",
"main": "dist/node/pusher.js",
"browser": "dist/web/pusher.js",
Expand Down
1 change: 1 addition & 0 deletions spec/javascripts/helpers/mocks.js
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,7 @@ var Mocks = {
manager.disconnect = jasmine.createSpy("disconnect");
manager.send_event = jasmine.createSpy("send_event");
manager.isUsingTLS = jasmine.createSpy("isUsingTLS").and.returnValue(false);
manager.switchCluster = jasmine.createSpy("switchCluster");
return manager;
},

Expand Down
14 changes: 14 additions & 0 deletions spec/javascripts/integration/index.web.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,5 +59,19 @@ function getTestConfigs() {
testConfigs.push({ transport: "sockjs", forceTLS: true})
testConfigs.push({ transport: "sockjs", forceTLS: false})
}

// Test all forceTLS: false before forceTLS: true
// Because browsers prevent a URL from downgrading from HTTPS to HTTP
// This is probably the result of Strict-Transport-Security header returned when calling the HTTPS endpoint.
testConfigs.sort((a, b) => {
if (a.forceTLS == false && b.forceTLS == true) {
return -1;
} else if (a.forceTLS == true && b.forceTLS == false) {
return 1;
} else {
return 0;
}
})

return testConfigs
}
43 changes: 43 additions & 0 deletions spec/javascripts/unit/core/connection/connection_manager_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,49 @@ describe("ConnectionManager", function() {
});
});

describe("#switchCluster", function() {
it("should update cluster key", function() {
expect(manager.key).toEqual("foo");
manager.switchCluster("bar");
expect(manager.key).toEqual("bar");
});

it("should re-build the strategy", function() {
expect(managerOptions.getStrategy.calls.count()).toEqual(1);
manager.switchCluster("bar");
expect(managerOptions.getStrategy.calls.count()).toEqual(2);
expect(managerOptions.getStrategy).toHaveBeenCalledWith({
key: "bar",
useTLS: false,
timeline: timeline
});
});

it("should try to connect using the strategy", function() {
manager.switchCluster("bar");
// connection is retried with a zero delay
jasmine.clock().tick(0);
expect(strategy.connect).toHaveBeenCalled();
});

it("should transition to connecting", function() {
var onConnecting = jasmine.createSpy("onConnecting");
var onStateChange = jasmine.createSpy("onStateChange");
manager.bind("connecting", onConnecting);
manager.bind("state_change", onStateChange);

manager.switchCluster("bar");// connection is retried with a zero delay
jasmine.clock().tick(0);

expect(manager.state).toEqual("connecting");
expect(onConnecting).toHaveBeenCalled();
expect(onStateChange).toHaveBeenCalledWith({
previous: "initialized",
current: "connecting"
});
});
});

describe("before establishing a connection", function() {
beforeEach(function() {
manager.connect();
Expand Down
Loading

0 comments on commit 401bf2b

Please sign in to comment.