pusher-js 7.0.0 → 7.0.4
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/.github/stale.yml +26 -0
- package/.github/workflows/release.yml +112 -0
- package/.github/workflows/release_pr.yml +42 -0
- package/.github/workflows/run-tests.yml +38 -0
- package/.vscode/settings.json +31 -0
- package/CHANGELOG.md +29 -0
- package/Makefile +17 -12
- package/README.md +28 -0
- package/dist/node/pusher.js +87 -45
- package/dist/node/pusher.js.map +1 -0
- package/dist/react-native/pusher.js +3 -2
- package/dist/react-native/pusher.js.map +1 -0
- package/dist/web/pusher-with-encryption.js +9 -6
- package/dist/web/pusher-with-encryption.js.map +1 -0
- package/dist/web/pusher-with-encryption.min.js +3 -2
- package/dist/web/pusher-with-encryption.min.js.map +1 -0
- package/dist/web/pusher.js +9 -6
- package/dist/web/pusher.js.map +1 -0
- package/dist/web/pusher.min.js +3 -2
- package/dist/web/pusher.min.js.map +1 -0
- package/dist/worker/pusher-with-encryption.worker.js +9 -6
- package/dist/worker/pusher-with-encryption.worker.js.map +1 -0
- package/dist/worker/pusher-with-encryption.worker.min.js +3 -2
- package/dist/worker/pusher-with-encryption.worker.min.js.map +1 -0
- package/dist/worker/pusher.worker.js +9 -6
- package/dist/worker/pusher.worker.js.map +1 -0
- package/dist/worker/pusher.worker.min.js +3 -2
- package/dist/worker/pusher.worker.min.js.map +1 -0
- package/package.json +17 -15
- package/react-native/index.d.ts +7 -8
- package/spec/config/jasmine/helpers/reporter.js +14 -0
- package/spec/config/jasmine/integration.json +13 -0
- package/spec/config/jasmine/unit.json +13 -0
- package/spec/config/{jasmine-node → jasmine}/webpack.integration.js +4 -4
- package/spec/config/{jasmine-node → jasmine}/webpack.unit.js +4 -6
- package/spec/config/karma/config.common.js +10 -4
- package/spec/config/karma/config.integration.js +4 -4
- package/spec/config/karma/config.unit.js +5 -7
- package/spec/config/karma/integration.js +3 -3
- package/spec/config/karma/unit.js +2 -2
- package/spec/javascripts/helpers/mocks.js +18 -18
- package/spec/javascripts/helpers/waitsFor.js +37 -0
- package/spec/javascripts/integration/core/cluster_config_spec.js +45 -34
- package/spec/javascripts/integration/core/falling_back_spec.js +124 -127
- package/spec/javascripts/integration/core/pusher_spec/test_builder.js +264 -284
- package/spec/javascripts/integration/core/timeout_configuration_spec.js +24 -22
- package/spec/javascripts/integration/core/transport_lists_spec.js +8 -8
- package/spec/javascripts/integration/web/dom/jsonp_spec.js +67 -69
- package/spec/javascripts/integration/web/dom/script_request_spec.js +44 -52
- package/spec/javascripts/unit/core/channels/channel_spec.js +32 -19
- package/spec/javascripts/unit/core/channels/encrypted_channel_spec.js +9 -17
- package/spec/javascripts/unit/core/channels/presence_channel_spec.js +8 -19
- package/spec/javascripts/unit/core/channels/private_channel_spec.js +9 -19
- package/spec/javascripts/unit/core/config_spec.js +2 -2
- package/spec/javascripts/unit/core/connection/connection_manager_spec.js +69 -63
- package/spec/javascripts/unit/core/connection/connection_spec.js +14 -13
- package/spec/javascripts/unit/core/connection/handshake_spec.js +14 -12
- package/spec/javascripts/unit/core/connection/protocol_spec.js +9 -4
- package/spec/javascripts/unit/core/defaults_spec.js +1 -1
- package/spec/javascripts/unit/core/events_dispatcher_spec.js +20 -20
- package/spec/javascripts/unit/core/http/http_polling_socket_spec.js +4 -4
- package/spec/javascripts/unit/core/http/http_request_spec.js +20 -17
- package/spec/javascripts/unit/core/http/http_socket_spec.js +35 -32
- package/spec/javascripts/unit/core/http/http_streaming_socket_spec.js +4 -4
- package/spec/javascripts/unit/core/http/http_xhr_request_spec.js +13 -13
- package/spec/javascripts/unit/core/pusher_authorizer_spec.js +11 -11
- package/spec/javascripts/unit/core/pusher_spec.js +41 -27
- package/spec/javascripts/unit/core/strategies/best_connected_ever_strategy_spec.js +5 -5
- package/spec/javascripts/unit/core/strategies/cached_strategy_spec.js +17 -13
- package/spec/javascripts/unit/core/strategies/delayed_strategy_spec.js +12 -8
- package/spec/javascripts/unit/core/strategies/sequential_strategy_spec.js +23 -19
- package/spec/javascripts/unit/core/strategies/transport_strategy_spec.js +22 -24
- package/spec/javascripts/unit/core/timeline/timeline_spec.js +16 -9
- package/spec/javascripts/unit/core/transports/assistant_to_the_transport_manager_spec.js +36 -22
- package/spec/javascripts/unit/core/transports/hosts_and_ports_spec.js +10 -10
- package/spec/javascripts/unit/core/transports/transport_connection_spec.js +81 -86
- package/spec/javascripts/unit/core/transports/transport_manager_spec.js +1 -1
- package/spec/javascripts/unit/core/utils/periodic_timer_spec.js +17 -16
- package/spec/javascripts/unit/core/utils/timers_spec.js +32 -26
- package/spec/javascripts/unit/isomorphic/transports/hosts_and_ports_spec.js +12 -8
- package/spec/javascripts/unit/isomorphic/transports/transports_spec.js +7 -7
- package/spec/javascripts/unit/node/timeline_sender_spec.js +5 -5
- package/spec/javascripts/unit/web/dom/dependency_loader_spec.js +30 -30
- package/spec/javascripts/unit/web/dom/jsonp_request_spec.js +7 -7
- package/spec/javascripts/unit/web/http/http_xdomain_request_spec.js +22 -22
- package/spec/javascripts/unit/web/pusher_authorizer_spec.js +3 -3
- package/spec/javascripts/unit/web/timeline/timeline_sender_spec.js +12 -12
- package/spec/javascripts/unit/web/transports/hosts_and_ports_spec.js +15 -12
- package/spec/javascripts/unit/web/transports/transports_spec.js +24 -26
- package/spec/javascripts/unit/worker/pusher_authorizer_spec.js +2 -2
- package/spec/javascripts/unit/worker/timeline_sender_spec.js +2 -2
- package/src/core/auth/options.ts +1 -0
- package/src/core/channels/channel.ts +1 -0
- package/src/core/pusher.ts +1 -1
- package/tags +393 -0
- package/types/src/core/auth/options.d.ts +1 -0
- package/webpack/config.node.js +2 -2
- package/webpack/config.react-native.js +2 -2
- package/webpack/config.shared.js +9 -1
- package/webpack/config.web.js +2 -2
- package/webpack/config.worker.js +2 -2
- package/with-encryption/index.d.ts +0 -1
- package/worker/index.d.ts +15 -0
- package/worker/index.js +1 -0
- package/worker/with-encryption/index.d.ts +15 -0
- package/worker/with-encryption/index.js +1 -0
- package/.travis.build +0 -22
- package/.travis.yml +0 -7
- package/spec/config/jasmine-node/config.js +0 -10
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# Configuration for probot-stale - https://github.com/probot/stale
|
|
2
|
+
|
|
3
|
+
# Number of days of inactivity before an Issue or Pull Request becomes stale
|
|
4
|
+
daysUntilStale: 90
|
|
5
|
+
|
|
6
|
+
# Number of days of inactivity before an Issue or Pull Request with the stale label is closed.
|
|
7
|
+
# Set to false to disable. If disabled, issues still need to be closed manually, but will remain marked as stale.
|
|
8
|
+
daysUntilClose: 7
|
|
9
|
+
|
|
10
|
+
# Only issues or pull requests with all of these labels are check if stale. Defaults to `[]` (disabled)
|
|
11
|
+
onlyLabels: []
|
|
12
|
+
|
|
13
|
+
# Issues or Pull Requests with these labels will never be considered stale. Set to `[]` to disable
|
|
14
|
+
exemptLabels:
|
|
15
|
+
- pinned
|
|
16
|
+
- security
|
|
17
|
+
|
|
18
|
+
# Set to true to ignore issues with an assignee (defaults to false)
|
|
19
|
+
exemptAssignees: true
|
|
20
|
+
|
|
21
|
+
# Comment to post when marking as stale. Set to `false` to disable
|
|
22
|
+
markComment: >
|
|
23
|
+
This issue has been automatically marked as stale because it has not had
|
|
24
|
+
recent activity. It will be closed if no further activity occurs. If you'd
|
|
25
|
+
like this issue to stay open please leave a comment indicating how this issue
|
|
26
|
+
is affecting you. Thank you.
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
on:
|
|
2
|
+
push:
|
|
3
|
+
branches: [ master ]
|
|
4
|
+
|
|
5
|
+
jobs:
|
|
6
|
+
check-release-tag:
|
|
7
|
+
runs-on: ubuntu-latest
|
|
8
|
+
steps:
|
|
9
|
+
- name: Checkout code
|
|
10
|
+
uses: actions/checkout@v2
|
|
11
|
+
with:
|
|
12
|
+
fetch-depth: 0
|
|
13
|
+
- name: Prepare tag
|
|
14
|
+
id: prepare_tag
|
|
15
|
+
continue-on-error: true
|
|
16
|
+
run: |
|
|
17
|
+
export TAG=v$(jq -r '.version' package.json)
|
|
18
|
+
echo "TAG=$TAG" >> $GITHUB_ENV
|
|
19
|
+
|
|
20
|
+
export CHECK_TAG=$(git tag | grep $TAG)
|
|
21
|
+
if [[ $CHECK_TAG ]]; then
|
|
22
|
+
echo "Skipping because release tag already exists"
|
|
23
|
+
exit 1
|
|
24
|
+
fi
|
|
25
|
+
- name: Output
|
|
26
|
+
id: release_output
|
|
27
|
+
if: ${{ steps.prepare_tag.outcome == 'success' }}
|
|
28
|
+
run: |
|
|
29
|
+
echo "::set-output name=tag::${{ env.TAG }}"
|
|
30
|
+
outputs:
|
|
31
|
+
tag: ${{ steps.release_output.outputs.tag }}
|
|
32
|
+
|
|
33
|
+
create-github-release:
|
|
34
|
+
runs-on: ubuntu-latest
|
|
35
|
+
needs: check-release-tag
|
|
36
|
+
if: ${{ needs.check-release-tag.outputs.tag }}
|
|
37
|
+
steps:
|
|
38
|
+
- uses: actions/checkout@v2
|
|
39
|
+
- name: Prepare tag
|
|
40
|
+
run: |
|
|
41
|
+
export TAG=v$(jq -r '.version' package.json)
|
|
42
|
+
echo "TAG=$TAG" >> $GITHUB_ENV
|
|
43
|
+
- name: Setup git
|
|
44
|
+
run: |
|
|
45
|
+
git config user.email "pusher-ci@pusher.com"
|
|
46
|
+
git config user.name "Pusher CI"
|
|
47
|
+
- name: Prepare description
|
|
48
|
+
run: |
|
|
49
|
+
csplit -s CHANGELOG.md "/##/" {1}
|
|
50
|
+
cat xx01 > CHANGELOG.tmp
|
|
51
|
+
- name: Create Release
|
|
52
|
+
uses: actions/create-release@v1
|
|
53
|
+
env:
|
|
54
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
55
|
+
with:
|
|
56
|
+
tag_name: ${{ env.TAG }}
|
|
57
|
+
release_name: ${{ env.TAG }}
|
|
58
|
+
body_path: CHANGELOG.tmp
|
|
59
|
+
draft: false
|
|
60
|
+
prerelease: false
|
|
61
|
+
|
|
62
|
+
publish-to-npm:
|
|
63
|
+
runs-on: ubuntu-latest
|
|
64
|
+
needs: create-github-release
|
|
65
|
+
steps:
|
|
66
|
+
- uses: actions/checkout@v2
|
|
67
|
+
- uses: flood-io/is-published-on-npm@8478347e2650eb228d303975415458183d0a37e4
|
|
68
|
+
id: is-published
|
|
69
|
+
- run: echo "This version is already published on NPM"
|
|
70
|
+
if: ${{ steps.is-published.outputs.published == 'true' }}
|
|
71
|
+
- uses: actions/setup-node@v2
|
|
72
|
+
if: ${{ steps.is-published.outputs.published == 'false' }}
|
|
73
|
+
with:
|
|
74
|
+
node-version: '14'
|
|
75
|
+
registry-url: https://registry.npmjs.org/
|
|
76
|
+
- run: npm install
|
|
77
|
+
if: ${{ steps.is-published.outputs.published == 'false' }}
|
|
78
|
+
- run: npm publish --access public
|
|
79
|
+
if: ${{ steps.is-published.outputs.published == 'false' }}
|
|
80
|
+
env:
|
|
81
|
+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
82
|
+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
83
|
+
|
|
84
|
+
upload-to-s3:
|
|
85
|
+
runs-on: ubuntu-latest
|
|
86
|
+
needs: create-github-release
|
|
87
|
+
steps:
|
|
88
|
+
- uses: actions/checkout@v2
|
|
89
|
+
- name: Upload to S3
|
|
90
|
+
run: |
|
|
91
|
+
VERSION=$(jq -r '.version' package.json | cut -d'.' -f1,2,3)
|
|
92
|
+
VERSION_MIN=$(jq -r '.version' package.json | cut -d'.' -f1,2)
|
|
93
|
+
|
|
94
|
+
egrep -o '^[0-9]+\.[0-9]+\.[0-9]+' <<< $VERSION
|
|
95
|
+
|
|
96
|
+
aws s3 sync dist/web/ s3://${BUCKET_NAME}/latest/ --acl public-read --cache-control max-age=$MAX_AGE
|
|
97
|
+
aws s3 sync dist/worker/ s3://${BUCKET_NAME}/latest/ --acl public-read --cache-control max-age=$MAX_AGE
|
|
98
|
+
|
|
99
|
+
aws s3 sync dist/web/ s3://${BUCKET_NAME}/${VERSION}/ --acl public-read --cache-control max-age=$MAX_AGE
|
|
100
|
+
aws s3 sync dist/worker/ s3://${BUCKET_NAME}/${VERSION}/ --acl public-read --cache-control max-age=$MAX_AGE
|
|
101
|
+
|
|
102
|
+
aws s3 sync dist/web/ s3://${BUCKET_NAME}/${VERSION_MIN}/ --acl public-read --cache-control max-age=$MAX_AGE
|
|
103
|
+
aws s3 sync dist/worker/ s3://${BUCKET_NAME}/${VERSION_MIN}/ --acl public-read --cache-control max-age=$MAX_AGE
|
|
104
|
+
|
|
105
|
+
aws cloudfront create-invalidation --distribution-id ${CLOUDFRONT_DISTRIBUTION_ID} --paths "/latest/*" "/${VERSION}/*" "/${VERSION_MIN}/*"
|
|
106
|
+
env:
|
|
107
|
+
MAX_AGE: 2592000
|
|
108
|
+
BUCKET_NAME: ${{ secrets.BUCKET_NAME }}
|
|
109
|
+
AWS_ACCESS_KEY_ID: ${{ secrets.PUSHERINOS_AWS_ACCESS_KEY_ID }}
|
|
110
|
+
AWS_SECRET_ACCESS_KEY: ${{ secrets.PUSHERINOS_AWS_SECRET_ACCESS_KEY }}
|
|
111
|
+
AWS_DEFAULT_REGION: eu-west-2
|
|
112
|
+
CLOUDFRONT_DISTRIBUTION_ID: ${{ secrets.CLOUDFRONT_DISTRIBUTION_ID }}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
name: release
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
pull_request:
|
|
5
|
+
types: [ labeled ]
|
|
6
|
+
branches:
|
|
7
|
+
- master
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
prepare-release:
|
|
11
|
+
name: Prepare release
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
steps:
|
|
14
|
+
- uses: actions/checkout@v2
|
|
15
|
+
- name: Get current version
|
|
16
|
+
shell: bash
|
|
17
|
+
run: |
|
|
18
|
+
CURRENT_VERSION=$(jq -r '.version' package.json)
|
|
19
|
+
echo "CURRENT_VERSION=$CURRENT_VERSION" >> $GITHUB_ENV
|
|
20
|
+
- uses: actions/checkout@v2
|
|
21
|
+
with:
|
|
22
|
+
repository: pusher/actions
|
|
23
|
+
token: ${{ secrets.PUSHER_CI_GITHUB_PRIVATE_TOKEN }}
|
|
24
|
+
path: .github/actions
|
|
25
|
+
- uses: ./.github/actions/prepare-version-bump
|
|
26
|
+
id: bump
|
|
27
|
+
with:
|
|
28
|
+
current_version: ${{ env.CURRENT_VERSION }}
|
|
29
|
+
- uses: actions/setup-node@v2
|
|
30
|
+
with:
|
|
31
|
+
node-version: '14'
|
|
32
|
+
- run: npm install
|
|
33
|
+
- name: Push
|
|
34
|
+
shell: bash
|
|
35
|
+
run: |
|
|
36
|
+
echo "$(jq '.version = "${{ steps.bump.outputs.new_version }}"' package.json)" > package.json
|
|
37
|
+
|
|
38
|
+
make build_all
|
|
39
|
+
|
|
40
|
+
git add package.json CHANGELOG.md dist/
|
|
41
|
+
git commit -m "Bump to version ${{ steps.bump.outputs.new_version }}"
|
|
42
|
+
git push
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
name: test
|
|
2
|
+
on:
|
|
3
|
+
push:
|
|
4
|
+
branches:
|
|
5
|
+
- '*'
|
|
6
|
+
pull_request:
|
|
7
|
+
branches:
|
|
8
|
+
- master
|
|
9
|
+
jobs:
|
|
10
|
+
run-web-tests:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
env:
|
|
13
|
+
CI: ${{ github.event_name == 'push' && 'basic' || 'full' }}
|
|
14
|
+
MINIMAL_INTEGRATION_TESTS: ${{ github.event_name == 'push' && 'true' || '' }}
|
|
15
|
+
steps:
|
|
16
|
+
- uses: actions/checkout@v2
|
|
17
|
+
- uses: actions/setup-node@v2
|
|
18
|
+
with:
|
|
19
|
+
node-version: '14'
|
|
20
|
+
- run: npm install
|
|
21
|
+
- run: npm run check-format
|
|
22
|
+
- run: make web_unit
|
|
23
|
+
- run: make web_integration
|
|
24
|
+
env:
|
|
25
|
+
BROWSER_STACK_ACCESS_KEY: ${{ secrets.BROWSER_STACK_ACCESS_KEY }}
|
|
26
|
+
BROWSER_STACK_USERNAME: ${{ secrets.BROWSER_STACK_USERNAME }}
|
|
27
|
+
run-node-tests:
|
|
28
|
+
runs-on: ubuntu-latest
|
|
29
|
+
steps:
|
|
30
|
+
- uses: actions/checkout@v2
|
|
31
|
+
- uses: actions/setup-node@v2
|
|
32
|
+
with:
|
|
33
|
+
node-version: '14'
|
|
34
|
+
- run: npm install
|
|
35
|
+
- run: npm run check-format
|
|
36
|
+
- run: make node_unit
|
|
37
|
+
- run: make node_integration
|
|
38
|
+
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
{
|
|
2
|
+
"yaml.customTags": [
|
|
3
|
+
"!And",
|
|
4
|
+
"!If",
|
|
5
|
+
"!Not",
|
|
6
|
+
"!Equals",
|
|
7
|
+
"!Or",
|
|
8
|
+
"!FindInMap",
|
|
9
|
+
"!Base64",
|
|
10
|
+
"!Cidr",
|
|
11
|
+
"!Ref",
|
|
12
|
+
"!Sub",
|
|
13
|
+
"!GetAtt",
|
|
14
|
+
"!GetAZs",
|
|
15
|
+
"!ImportValue",
|
|
16
|
+
"!Select",
|
|
17
|
+
"!Split",
|
|
18
|
+
"!Join",
|
|
19
|
+
"!And sequence",
|
|
20
|
+
"!If sequence",
|
|
21
|
+
"!Not sequence",
|
|
22
|
+
"!Equals sequence",
|
|
23
|
+
"!Or sequence",
|
|
24
|
+
"!FindInMap sequence",
|
|
25
|
+
"!Join sequence",
|
|
26
|
+
"!Sub sequence",
|
|
27
|
+
"!ImportValue sequence",
|
|
28
|
+
"!Select sequence",
|
|
29
|
+
"!Split sequence"
|
|
30
|
+
]
|
|
31
|
+
}
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,34 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 7.0.4
|
|
4
|
+
|
|
5
|
+
* [FIXED] References to nonexistent source map #570
|
|
6
|
+
|
|
7
|
+
## 7.0.3 (2021-01-25)
|
|
8
|
+
|
|
9
|
+
[UPDATED] Bumped version of faye-websocket (used only by the node runtime) from
|
|
10
|
+
0.9.4 to 0.11.3. Thanks to @Akhawais for the PR.
|
|
11
|
+
|
|
12
|
+
[UPDATED] Bumped version of @react-native-community/netinfo (used only by the
|
|
13
|
+
react-native runtime) from 4.1.1 to 5.9.7. Thanks to @Yinabled for the PR.
|
|
14
|
+
|
|
15
|
+
[ADDED] We were missing a react-native key in `package.json`. Thanks to @giaset
|
|
16
|
+
for the PR
|
|
17
|
+
|
|
18
|
+
[ADDED] Support for importing the worker builds (solving issue #499)
|
|
19
|
+
|
|
20
|
+
## 7.0.2 (2020-11-26)
|
|
21
|
+
|
|
22
|
+
[FIXED] Removes `AuthInfo` type from react-native and with-encryption builds.
|
|
23
|
+
This type was removed everywhere else in v7.0.0. See [issue
|
|
24
|
+
512](https://github.com/pusher/pusher-js/issues/512)
|
|
25
|
+
|
|
26
|
+
## 7.0.1 (2020-11-02)
|
|
27
|
+
|
|
28
|
+
[FIXED] Channels no longer get stuck in the `subscriptionPending` state
|
|
29
|
+
after a failed request to an auth endpoint. [Fixes Issue
|
|
30
|
+
255](https://github.com/pusher/pusher-js/issues/255)
|
|
31
|
+
|
|
3
32
|
## 7.0.0 (2020-07-30)
|
|
4
33
|
|
|
5
34
|
[UPDATED] Type signatures for authorizer callback. Previously the authorizer
|
package/Makefile
CHANGED
|
@@ -1,17 +1,14 @@
|
|
|
1
1
|
SHELL := /bin/bash
|
|
2
2
|
|
|
3
|
+
.PHONY: build_all
|
|
3
4
|
build_all: web react-native node worker
|
|
4
5
|
|
|
5
|
-
|
|
6
|
-
# pushd src/runtimes/web/dom/sockjs && \
|
|
7
|
-
# npm install && \
|
|
8
|
-
# make build && \
|
|
9
|
-
# popd
|
|
10
|
-
|
|
6
|
+
.PHONY: json2
|
|
11
7
|
json2:
|
|
12
8
|
cp src/runtimes/web/dom/json2.js dist/web
|
|
13
9
|
node_modules/.bin/uglifyjs dist/web/json2.js -o dist/web/json2.min.js
|
|
14
10
|
|
|
11
|
+
.PHONY: web
|
|
15
12
|
web:
|
|
16
13
|
@echo "Browser Release:"
|
|
17
14
|
MINIMIZE=false node_modules/webpack/bin/webpack.js --config=webpack/config.web.js
|
|
@@ -25,14 +22,17 @@ web:
|
|
|
25
22
|
@echo "Minified Browser Release (with encryption)"
|
|
26
23
|
INCLUDE_TWEETNACL=true node_modules/webpack/bin/webpack.js --config=webpack/config.web.js
|
|
27
24
|
|
|
25
|
+
.PHONY: react-native
|
|
28
26
|
react-native:
|
|
29
27
|
@echo "React Native Release:"
|
|
30
28
|
node_modules/webpack/bin/webpack.js --config=webpack/config.react-native.js
|
|
31
29
|
|
|
30
|
+
.PHONY: node
|
|
32
31
|
node:
|
|
33
32
|
@echo "NodeJS Release":
|
|
34
33
|
MINIMIZE=false node_modules/webpack/bin/webpack.js --config=webpack/config.node.js
|
|
35
34
|
|
|
35
|
+
.PHONY: worker
|
|
36
36
|
worker:
|
|
37
37
|
@echo "Web Worker Release"
|
|
38
38
|
MINIMIZE=false node_modules/webpack/bin/webpack.js --config=webpack/config.worker.js
|
|
@@ -46,27 +46,32 @@ worker:
|
|
|
46
46
|
@echo "Minified Web Worker Release (with encryption)"
|
|
47
47
|
INCLUDE_TWEETNACL=true node_modules/webpack/bin/webpack.js --config=webpack/config.worker.js
|
|
48
48
|
|
|
49
|
+
.PHONY: web_unit
|
|
49
50
|
web_unit:
|
|
50
51
|
node_modules/karma/bin/karma start spec/config/karma/unit.js
|
|
51
52
|
|
|
53
|
+
.PHONY: web_integration
|
|
52
54
|
web_integration:
|
|
53
55
|
node_modules/karma/bin/karma start spec/config/karma/integration.js
|
|
54
56
|
|
|
57
|
+
.PHONY: worker_unit
|
|
55
58
|
worker_unit:
|
|
56
59
|
WORKER=true node_modules/karma/bin/karma start spec/config/karma/unit.js
|
|
57
60
|
|
|
61
|
+
.PHONY: worker_integration
|
|
58
62
|
worker_integration:
|
|
59
63
|
WORKER=true node_modules/karma/bin/karma start spec/config/karma/integration.js
|
|
60
64
|
|
|
65
|
+
.PHONY: node_unit
|
|
61
66
|
node_unit:
|
|
62
|
-
node_modules/webpack/bin/webpack.js --config=spec/config/jasmine
|
|
63
|
-
|
|
67
|
+
node_modules/webpack/bin/webpack.js --config=spec/config/jasmine/webpack.unit.js && \
|
|
68
|
+
node_modules/.bin/jasmine --config=spec/config/jasmine/unit.json
|
|
64
69
|
|
|
70
|
+
.PHONY: node_integration
|
|
65
71
|
node_integration:
|
|
66
|
-
node_modules/webpack/bin/webpack.js --config=spec/config/jasmine
|
|
67
|
-
|
|
72
|
+
node_modules/webpack/bin/webpack.js --config=spec/config/jasmine/webpack.integration.js && \
|
|
73
|
+
node_modules/.bin/jasmine --config=spec/config/jasmine/integration.json
|
|
68
74
|
|
|
75
|
+
.PHONY: serve
|
|
69
76
|
serve:
|
|
70
77
|
node webpack/dev.server.js
|
|
71
|
-
|
|
72
|
-
.PHONY: react-native build_all
|
package/README.md
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# Pusher Channels Javascript Client
|
|
2
2
|
|
|
3
|
+

|
|
4
|
+
|
|
3
5
|
This Pusher Channels client library supports web browsers, web workers, Node.js
|
|
4
6
|
and React Native.
|
|
5
7
|
|
|
@@ -181,6 +183,18 @@ If you'd like to use encrypted channels:
|
|
|
181
183
|
importScripts('https://js.pusher.com/7.0/pusher-with-encryption.worker.min.js');
|
|
182
184
|
```
|
|
183
185
|
|
|
186
|
+
If you're building your worker with a bundler, you can import the worker entrypoint
|
|
187
|
+
|
|
188
|
+
```
|
|
189
|
+
import Pusher from 'pusher-js/worker'
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
If you'd like to use encrypted channels:
|
|
193
|
+
|
|
194
|
+
```
|
|
195
|
+
import Pusher from 'pusher-js/worker/with-encryption'
|
|
196
|
+
```
|
|
197
|
+
|
|
184
198
|
### Node.js
|
|
185
199
|
|
|
186
200
|
Having installed `pusher-js` via an NPM-compatible package manager, run:
|
|
@@ -598,6 +612,20 @@ channel.unbind_global();
|
|
|
598
612
|
|
|
599
613
|
The `unbind_all` method is equivalent to calling `unbind()` and `unbind_global()` together; it removes all bindings, global and event specific.
|
|
600
614
|
|
|
615
|
+
## Triggering Client Events
|
|
616
|
+
|
|
617
|
+
It's possible to trigger [client events](https://pusher.com/docs/channels/using_channels/events#triggering-client-events) using the `trigger` method on an instance of the `Channel` class.
|
|
618
|
+
|
|
619
|
+
A few gotchas to consider when using client events:
|
|
620
|
+
- Client events can only be triggered on private/presence channels
|
|
621
|
+
- Client events must be enabled in the settings page for your app: `https://dashboard.pusher.com/apps/$YOUR_APP_ID/settings`
|
|
622
|
+
- The event name for client events *must* start with `client-`
|
|
623
|
+
|
|
624
|
+
```
|
|
625
|
+
channel.trigger('client-my-event', {message: 'Hello, world!'})
|
|
626
|
+
```
|
|
627
|
+
|
|
628
|
+
|
|
601
629
|
## Batching auth requests (aka multi-auth)
|
|
602
630
|
|
|
603
631
|
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.
|