pusher-js 8.4.0 → 8.4.2
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/workflows/release.yml +23 -31
- package/CHANGELOG.md +8 -0
- package/package.json +11 -1
- package/src/runtimes/web/dom/sockjs/COPYING +0 -11
- package/src/runtimes/web/dom/sockjs/Changelog +0 -147
- package/src/runtimes/web/dom/sockjs/LICENSE-MIT-SockJS +0 -19
- package/src/runtimes/web/dom/sockjs/Makefile +0 -109
- package/src/runtimes/web/dom/sockjs/README.md +0 -388
- package/src/runtimes/web/dom/sockjs/VERSION-GEN +0 -17
- package/src/runtimes/web/dom/sockjs/bin/render.coffee +0 -111
- package/src/runtimes/web/dom/sockjs/bin/run_testling.sh +0 -135
- package/src/runtimes/web/dom/sockjs/package.json +0 -18
- package/src/runtimes/web/dom/sockjs/version +0 -1
|
@@ -7,18 +7,17 @@ jobs:
|
|
|
7
7
|
runs-on: ubuntu-latest
|
|
8
8
|
steps:
|
|
9
9
|
- name: Checkout code
|
|
10
|
-
uses: actions/checkout@
|
|
10
|
+
uses: actions/checkout@v4
|
|
11
11
|
with:
|
|
12
12
|
fetch-depth: 0
|
|
13
13
|
- name: Prepare tag
|
|
14
14
|
id: prepare_tag
|
|
15
15
|
continue-on-error: true
|
|
16
16
|
run: |
|
|
17
|
-
|
|
17
|
+
TAG=v$(jq -r '.version' package.json)
|
|
18
18
|
echo "TAG=$TAG" >> $GITHUB_ENV
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
if [[ $CHECK_TAG ]]; then
|
|
20
|
+
if git tag | grep -q "^${TAG}$"; then
|
|
22
21
|
echo "Skipping because release tag already exists"
|
|
23
22
|
exit 1
|
|
24
23
|
fi
|
|
@@ -26,7 +25,7 @@ jobs:
|
|
|
26
25
|
id: release_output
|
|
27
26
|
if: ${{ steps.prepare_tag.outcome == 'success' }}
|
|
28
27
|
run: |
|
|
29
|
-
echo "
|
|
28
|
+
echo "tag=${{ env.TAG }}" >> $GITHUB_OUTPUT
|
|
30
29
|
outputs:
|
|
31
30
|
tag: ${{ steps.release_output.outputs.tag }}
|
|
32
31
|
|
|
@@ -35,48 +34,41 @@ jobs:
|
|
|
35
34
|
needs: check-release-tag
|
|
36
35
|
if: ${{ needs.check-release-tag.outputs.tag }}
|
|
37
36
|
steps:
|
|
38
|
-
- uses: actions/checkout@
|
|
37
|
+
- uses: actions/checkout@v4
|
|
39
38
|
- name: Prepare tag
|
|
40
39
|
run: |
|
|
41
|
-
|
|
40
|
+
TAG=v$(jq -r '.version' package.json)
|
|
42
41
|
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
42
|
- name: Prepare description
|
|
48
43
|
run: |
|
|
49
44
|
csplit -s CHANGELOG.md "/##/" {1}
|
|
50
45
|
cat xx01 > CHANGELOG.tmp
|
|
51
46
|
- name: Create Release
|
|
52
|
-
|
|
47
|
+
run: |
|
|
48
|
+
gh release create "${{ env.TAG }}" \
|
|
49
|
+
--title "${{ env.TAG }}" \
|
|
50
|
+
--notes-file CHANGELOG.tmp
|
|
53
51
|
env:
|
|
54
52
|
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
53
|
|
|
62
54
|
publish-to-npm:
|
|
63
55
|
runs-on: ubuntu-latest
|
|
64
56
|
needs: create-github-release
|
|
65
57
|
steps:
|
|
66
|
-
- uses: actions/checkout@
|
|
67
|
-
- uses:
|
|
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' }}
|
|
58
|
+
- uses: actions/checkout@v4
|
|
59
|
+
- uses: actions/setup-node@v4
|
|
73
60
|
with:
|
|
74
|
-
node-version: '
|
|
61
|
+
node-version: '20'
|
|
75
62
|
registry-url: https://registry.npmjs.org/
|
|
76
63
|
- run: npm install
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
64
|
+
- name: Publish if not already published
|
|
65
|
+
run: |
|
|
66
|
+
VERSION=$(jq -r '.version' package.json)
|
|
67
|
+
if npm view pusher-js@$VERSION version 2>/dev/null; then
|
|
68
|
+
echo "Version $VERSION already on npm, skipping."
|
|
69
|
+
else
|
|
70
|
+
npm publish --access public
|
|
71
|
+
fi
|
|
80
72
|
env:
|
|
81
73
|
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
82
74
|
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
@@ -85,13 +77,13 @@ jobs:
|
|
|
85
77
|
runs-on: ubuntu-latest
|
|
86
78
|
needs: create-github-release
|
|
87
79
|
steps:
|
|
88
|
-
- uses: actions/checkout@
|
|
80
|
+
- uses: actions/checkout@v4
|
|
89
81
|
- name: Upload to S3
|
|
90
82
|
run: |
|
|
91
83
|
VERSION=$(jq -r '.version' package.json | cut -d'.' -f1,2,3)
|
|
92
84
|
VERSION_MIN=$(jq -r '.version' package.json | cut -d'.' -f1,2)
|
|
93
85
|
|
|
94
|
-
|
|
86
|
+
grep -Eo '^[0-9]+\.[0-9]+\.[0-9]+' <<< $VERSION
|
|
95
87
|
|
|
96
88
|
aws s3 sync dist/web/ s3://${BUCKET_NAME}/latest/ --acl public-read --cache-control max-age=$MAX_AGE
|
|
97
89
|
aws s3 sync dist/worker/ s3://${BUCKET_NAME}/latest/ --acl public-read --cache-control max-age=$MAX_AGE
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 8.4.2
|
|
4
|
+
|
|
5
|
+
- [CHANGED] Modernise release workflow: update action versions, replace deprecated flood-io/is-published-on-npm action with inline npm registry check
|
|
6
|
+
|
|
7
|
+
## 8.4.1
|
|
8
|
+
|
|
9
|
+
- [FIXED] Pin transitive dependencies to patched versions to resolve known vulnerabilities (cipher-base, pbkdf2, sha.js, node-forge, js-yaml, compression, on-headers, tmp)
|
|
10
|
+
|
|
3
11
|
## 8.4.0
|
|
4
12
|
|
|
5
13
|
- [CHANGED] Dependencies minor versions updated to latest versions
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pusher-js",
|
|
3
|
-
"version": "8.4.
|
|
3
|
+
"version": "8.4.2",
|
|
4
4
|
"description": "Pusher Channels JavaScript library for browsers, React Native, NodeJS and web workers",
|
|
5
5
|
"main": "dist/node/pusher.js",
|
|
6
6
|
"browser": "dist/web/pusher.js",
|
|
@@ -66,5 +66,15 @@
|
|
|
66
66
|
},
|
|
67
67
|
"dependencies": {
|
|
68
68
|
"tweetnacl": "^1.0.3"
|
|
69
|
+
},
|
|
70
|
+
"overrides": {
|
|
71
|
+
"cipher-base": "^1.0.6",
|
|
72
|
+
"compression": "^1.8.1",
|
|
73
|
+
"js-yaml": "^3.14.2",
|
|
74
|
+
"node-forge": "^1.3.2",
|
|
75
|
+
"on-headers": "^1.1.0",
|
|
76
|
+
"pbkdf2": "^3.1.5",
|
|
77
|
+
"sha.js": "^2.4.12",
|
|
78
|
+
"tmp": "^0.2.4"
|
|
69
79
|
}
|
|
70
80
|
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
Parts of the code are derived from various open source projects.
|
|
2
|
-
|
|
3
|
-
For code derived from Socket.IO by Guillermo Rauch see
|
|
4
|
-
https://github.com/LearnBoost/socket.io/tree/0.6.17#readme.
|
|
5
|
-
|
|
6
|
-
Snippets derived from JSON-js by Douglas Crockford are public domain.
|
|
7
|
-
|
|
8
|
-
Snippets derived from jQuery-JSONP by Julian Aubourg, generic MIT
|
|
9
|
-
license.
|
|
10
|
-
|
|
11
|
-
All other code is released on MIT license, see LICENSE-MIT-SockJS.
|
|
@@ -1,147 +0,0 @@
|
|
|
1
|
-
0.3.4
|
|
2
|
-
=====
|
|
3
|
-
|
|
4
|
-
* Mentioned njoyce's fork of sockjs-gevent.
|
|
5
|
-
* #90 - Don't catch onbeforeunload event - it breaks javascript://
|
|
6
|
-
links in IE.
|
|
7
|
-
* IE mangles 204 response code for 1223 on ajax, see:
|
|
8
|
-
http://bugs.jquery.com/ticket/1450
|
|
9
|
-
* Make `new` optional for SockJS constructor (via substack).
|
|
10
|
-
* It is impossible to cancel JSONP polling request - compensate for that.
|
|
11
|
-
* Refactored EventEmitter prototype (used only internally)
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
0.3.2
|
|
15
|
-
=====
|
|
16
|
-
|
|
17
|
-
* #77 - Getting /info on modern browsers when html is served from
|
|
18
|
-
file:// urls was broken.
|
|
19
|
-
|
|
20
|
-
0.3.1
|
|
21
|
-
=====
|
|
22
|
-
|
|
23
|
-
* #61 - Meteor guys found that we unintentionally catch "onopen" errors.
|
|
24
|
-
* #63 - Meteorjs guys found that xhr-streaming on Safari sometimes
|
|
25
|
-
left busy cursor running.
|
|
26
|
-
* Increased allowed time for websocket transport (from 1 rtt to 2),
|
|
27
|
-
this should make ws transport more reliable over SSL, at the cost
|
|
28
|
-
of slightly longer connection time for users with blocked ws.
|
|
29
|
-
* #57 - previous fix didn't really work, sockjs-client still left
|
|
30
|
-
a mess in browsers history when using iframe transports. This
|
|
31
|
-
is fixed now.
|
|
32
|
-
* #60 - Opera 12 (next) claims to do AJAX2 / CORS, but can't
|
|
33
|
-
do xhr-streaming.
|
|
34
|
-
* #58 - onunload test sometimes failed on Safari on windows
|
|
35
|
-
* Updated readme WRT websocket protocols
|
|
36
|
-
* Updated readme WRT deployments on heroku
|
|
37
|
-
* Add minimalistic license block to every source file.
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
0.3.0
|
|
41
|
-
=====
|
|
42
|
-
|
|
43
|
-
* Temporarily disabled iframe tests - they are failing unpredictably.
|
|
44
|
-
* #57 - pointing an iframe to "about:blank" during cleanup caused
|
|
45
|
-
Opera to messup history.
|
|
46
|
-
* #55 - Improved iframe abstraction (reduced a possible mem leak)
|
|
47
|
-
* Refactored AJAX abstractions, for better CORS handing - again.
|
|
48
|
-
* Add additional parent origin security check to an iframe.
|
|
49
|
-
* Urls with hashes or query strings can't be passed to SockJS.
|
|
50
|
-
* #18 - Mention workaround for Firefox ESC key issue
|
|
51
|
-
* #53 - AMD compliance
|
|
52
|
-
* sockjs/sockjs-protocol#28 - always use square brackets for
|
|
53
|
-
websocket frames
|
|
54
|
-
* #51 - initial support for IE10 - try XHR before XDR
|
|
55
|
-
* #28 - handle onunload / onbeforeunload in a more robust fashion
|
|
56
|
-
* #49 - support SockJS-client being used from files served from
|
|
57
|
-
file:// urls.
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
0.2.1
|
|
61
|
-
=====
|
|
62
|
-
|
|
63
|
-
* "smoke-latency.html" test was unnecesairly sending too much data.
|
|
64
|
-
* Bumped core dependencies (coffee-script and uglify-js)
|
|
65
|
-
* Minor updates to the README, few cosmetic changes in the code.
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
0.2.0
|
|
69
|
-
=====
|
|
70
|
-
|
|
71
|
-
* The API had changed - use `protocols_whitelist` option instead of
|
|
72
|
-
passing an array of protocols as a second argument to SockJS constructor.
|
|
73
|
-
* Dropped 'chunking-test' functionality and replace it with 'info'.
|
|
74
|
-
* Rewritten protocol-choosing alogirthm, see "utils.detectProtocols" method.
|
|
75
|
-
* Use dynamic protocol timeouts based on RTT, not hardcoded 5 seconds
|
|
76
|
-
* #34 - Don't ever reuse `session_id`, especially when trying
|
|
77
|
-
fallback protocols.
|
|
78
|
-
* The test server got moved from SockJS-client to SockJS-node.
|
|
79
|
-
* Don't test unicode surrogates - it can't work in some environments.
|
|
80
|
-
* XHR/XDR helpers were rewritten, ajax transports were simplified.
|
|
81
|
-
* Added a domain check in the iframe to improve security.
|
|
82
|
-
* SockJS will now trigger 1002 error if there is a problem during handshake
|
|
83
|
-
instead of 2000 error.
|
|
84
|
-
* Smoke-throughput test is renamed to smoke-latency.
|
|
85
|
-
|
|
86
|
-
0.1.2
|
|
87
|
-
=====
|
|
88
|
-
|
|
89
|
-
* #29 - Allow all unicode characters to be send over SockJS.
|
|
90
|
-
* #15 - SockJS should now work fine even if the connection is started
|
|
91
|
-
in HEAD, before BODY is loaded.
|
|
92
|
-
* #28 - In rare circumstances WebSocket connection can be left intact
|
|
93
|
-
after the page is unloaded in FireFox.
|
|
94
|
-
* Updated scripts to work with Node 0.6.
|
|
95
|
-
* Initial work to do better QUnit testing.
|
|
96
|
-
* Updated the minifying script (always escape unicode chars, remove
|
|
97
|
-
trailing comment).
|
|
98
|
-
* Use string instead of array of chars (utils.js:random_number_string).
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
0.1.1
|
|
102
|
-
=====
|
|
103
|
-
|
|
104
|
-
* #21 Get JsonP transport working on IE9 (Vladimir Dronnikov).
|
|
105
|
-
* #26 Emit heartbeat event.
|
|
106
|
-
* #27 Include license inline.
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
0.1.0
|
|
110
|
-
=====
|
|
111
|
-
|
|
112
|
-
* SockJS-client can only send UTF-8 encodable strings. Previously we
|
|
113
|
-
took advantage of rich data structures and automatically
|
|
114
|
-
json-encoded them, but this got removed. Now, all data passed to
|
|
115
|
-
`send` will be converted to string. This is also how native
|
|
116
|
-
* `status` property on `EventClose` is renamed to `code`
|
|
117
|
-
as per Websocket API
|
|
118
|
-
WebSockets behave.
|
|
119
|
-
* The test server was updated to new `sockjs-node` API
|
|
120
|
-
* Fixed problem with Jsonp-polling transport on IE9
|
|
121
|
-
* Repository was moved - updated links.
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
0.0.4
|
|
125
|
-
=====
|
|
126
|
-
|
|
127
|
-
* All transports were refactored, some transports were introduced:
|
|
128
|
-
htmlfile and separate xhr-streaming.
|
|
129
|
-
* Added logic to detect support for http chunking, and thus a
|
|
130
|
-
possibility to rule out streaming transports before running them.
|
|
131
|
-
* Added 'cookie' option, useful for cookie-based load balancing
|
|
132
|
-
(currently, it make a difference only for IE).
|
|
133
|
-
* Added hack to prevent EventSource from crashing Safari and Chrome.
|
|
134
|
-
* Loads and loads of other small and medium changes.
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
0.0.2
|
|
138
|
-
=====
|
|
139
|
-
|
|
140
|
-
* Initial support for JSESSIONID based load balancing. Currently
|
|
141
|
-
doesn't play nicely with IE XDomainRequest transport.
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
0.0.1
|
|
145
|
-
=====
|
|
146
|
-
|
|
147
|
-
* Initial release.
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
Copyright (c) 2011-2012 VMware, Inc.
|
|
2
|
-
|
|
3
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
4
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
5
|
-
in the Software without restriction, including without limitation the rights
|
|
6
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
7
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
8
|
-
furnished to do so, subject to the following conditions:
|
|
9
|
-
|
|
10
|
-
The above copyright notice and this permission notice shall be included in
|
|
11
|
-
all copies or substantial portions of the Software.
|
|
12
|
-
|
|
13
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
14
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
15
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
16
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
17
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
18
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
19
|
-
THE SOFTWARE.
|
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
.PHONY: all build tests test serve clean
|
|
2
|
-
|
|
3
|
-
COFFEE:=./node_modules/.bin/coffee
|
|
4
|
-
|
|
5
|
-
all: sockjs.js
|
|
6
|
-
|
|
7
|
-
build: sockjs.js sockjs.min.js
|
|
8
|
-
|
|
9
|
-
sockjs.js: lib/*js version
|
|
10
|
-
@$(COFFEE) -v > /dev/null
|
|
11
|
-
$(COFFEE) bin/render.coffee --set-version $(VER) lib/all.js > $@
|
|
12
|
-
|
|
13
|
-
sockjs.min.js: lib/*js version
|
|
14
|
-
@$(COFFEE) -v > /dev/null
|
|
15
|
-
$(COFFEE) bin/render.coffee --set-version $(VER) --minify lib/all.js > $@
|
|
16
|
-
|
|
17
|
-
sockjs.pretty.js: lib/*js version
|
|
18
|
-
@$(COFFEE) -v > /dev/null
|
|
19
|
-
$(COFFEE) bin/render.coffee --set-version $(VER) --minify --pretty lib/all.js > $@
|
|
20
|
-
|
|
21
|
-
tests/html/lib/sockjs.js: sockjs.js
|
|
22
|
-
cp $< $@
|
|
23
|
-
|
|
24
|
-
tests/html/lib/%.js: tests/html/src/%.coffee
|
|
25
|
-
@$(COFFEE) -v > /dev/null
|
|
26
|
-
$(COFFEE) -o tests/html/lib/ -c --bare $<
|
|
27
|
-
|
|
28
|
-
build_tests: tests/html/lib/sockjs.js tests/html/lib/tests.js \
|
|
29
|
-
tests/html/lib/unittests.js tests/html/lib/domtests.js \
|
|
30
|
-
tests/html/lib/endtoendtests.js \
|
|
31
|
-
tests/html/lib/utils.js \
|
|
32
|
-
tests/html/lib/heartbeattests.js
|
|
33
|
-
|
|
34
|
-
test: tests
|
|
35
|
-
tests: build_tests
|
|
36
|
-
node tests/server.js
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
serve:
|
|
40
|
-
@if [ -e .pidfile.pid ]; then \
|
|
41
|
-
kill `cat .pidfile.pid`; \
|
|
42
|
-
rm .pidfile.pid; \
|
|
43
|
-
fi
|
|
44
|
-
|
|
45
|
-
@while [ 1 ]; do \
|
|
46
|
-
make build_tests; \
|
|
47
|
-
echo " [*] Running http server"; \
|
|
48
|
-
make test & \
|
|
49
|
-
SRVPID=$$!; \
|
|
50
|
-
echo $$SRVPID > .pidfile.pid; \
|
|
51
|
-
echo " [*] Server pid: $$SRVPID"; \
|
|
52
|
-
inotifywait -r -q -e modify . ../sockjs-node; \
|
|
53
|
-
kill `cat .pidfile.pid`; \
|
|
54
|
-
rm -f .pidfile.pid; \
|
|
55
|
-
sleep 0.1; \
|
|
56
|
-
done
|
|
57
|
-
|
|
58
|
-
clean:
|
|
59
|
-
rm -f sockjs*.js tests/html/lib/*.js
|
|
60
|
-
|
|
61
|
-
# To release:
|
|
62
|
-
# 0) 'make prepare-release'
|
|
63
|
-
# 1) commit everything you need
|
|
64
|
-
# 2) amend 'version' file (don't commit)
|
|
65
|
-
# 3) run 'make tag', and git push/git push --tag as suggested
|
|
66
|
-
# 4) run 'make upload', and suggested commands
|
|
67
|
-
|
|
68
|
-
RVER:=$(shell cat version)
|
|
69
|
-
VER:=$(shell ./VERSION-GEN)
|
|
70
|
-
# The first two dots: 1.2.3 -> 1.2
|
|
71
|
-
MAJVER:=$(shell echo $(VER)|sed 's|^\([^.]\+[.][^.]\+\).*$$|\1|' )
|
|
72
|
-
|
|
73
|
-
.PHONY: prepare-release tag upload
|
|
74
|
-
prepare-release:
|
|
75
|
-
make clean
|
|
76
|
-
[ -e ../sockjs-client-gh-pages ] || \
|
|
77
|
-
git clone `git remote -v|tr "[:space:]" "\t"|cut -f 2` \
|
|
78
|
-
--branch gh-pages ../sockjs-client-gh-pages
|
|
79
|
-
(cd ../sockjs-client-gh-pages; git pull;)
|
|
80
|
-
|
|
81
|
-
#-git tag -d v$(RVER)
|
|
82
|
-
tag:
|
|
83
|
-
git commit $(TAG_OPTS) version Changelog -m "Release $(RVER)" --allow-empty
|
|
84
|
-
git tag -s v$(RVER) -m "Release $(RVER)"
|
|
85
|
-
@echo ' [*] Now run'
|
|
86
|
-
@echo 'git push; git push --tag'
|
|
87
|
-
|
|
88
|
-
ARTIFACTS=\
|
|
89
|
-
sockjs-$(VER).js \
|
|
90
|
-
sockjs-$(VER).min.js \
|
|
91
|
-
sockjs-$(MAJVER).js \
|
|
92
|
-
sockjs-$(MAJVER).min.js
|
|
93
|
-
|
|
94
|
-
upload: build
|
|
95
|
-
echo "VER=$(VER) MAJVER=$(MAJVER)"
|
|
96
|
-
cp sockjs.js ../sockjs-client-gh-pages/sockjs-$(VER).js
|
|
97
|
-
cp sockjs.min.js ../sockjs-client-gh-pages/sockjs-$(VER).min.js
|
|
98
|
-
cp sockjs.js ../sockjs-client-gh-pages/sockjs-$(MAJVER).js
|
|
99
|
-
cp sockjs.min.js ../sockjs-client-gh-pages/sockjs-$(MAJVER).min.js
|
|
100
|
-
(cd ../sockjs-client-gh-pages; \
|
|
101
|
-
git add $(ARTIFACTS); \
|
|
102
|
-
git commit -m "Release $(VER)"; \
|
|
103
|
-
node generate_index.js > index.html; \
|
|
104
|
-
git add index.html; \
|
|
105
|
-
git commit --amend -m "Release $(VER)";)
|
|
106
|
-
@echo ' [*] Now run: '
|
|
107
|
-
@echo '(cd ../sockjs-client-gh-pages; git push; )'
|
|
108
|
-
@echo '(cd ../sockjs-client-gh-pages; \
|
|
109
|
-
s3cmd put --acl-public index.html $(ARTIFACTS) s3://sockjs; );'
|
|
@@ -1,388 +0,0 @@
|
|
|
1
|
-
SockJS family:
|
|
2
|
-
|
|
3
|
-
* [SockJS-client](https://github.com/sockjs/sockjs-client) JavaScript client library
|
|
4
|
-
* [SockJS-node](https://github.com/sockjs/sockjs-node) Node.js server
|
|
5
|
-
* [SockJS-erlang](https://github.com/sockjs/sockjs-erlang) Erlang server
|
|
6
|
-
* [SockJS-lua](https://github.com/luvit/sockjs-luvit) Lua/Luvit server
|
|
7
|
-
* [SockJS-tornado](https://github.com/MrJoes/sockjs-tornado) Python/Tornado server
|
|
8
|
-
* [vert.x](https://github.com/vert-x/vert.x) Java/vert.x server
|
|
9
|
-
|
|
10
|
-
Work in progress:
|
|
11
|
-
|
|
12
|
-
* [SockJS-ruby](https://github.com/sockjs/sockjs-ruby)
|
|
13
|
-
* [SockJS-netty](https://github.com/cgbystrom/sockjs-netty)
|
|
14
|
-
* [SockJS-gevent](https://github.com/sdiehl/sockjs-gevent) ([SockJS-gevent fork](https://github.com/njoyce/sockjs-gevent))
|
|
15
|
-
* [pyramid-SockJS](https://github.com/fafhrd91/pyramid_sockjs)
|
|
16
|
-
* [wildcloud-websockets](https://github.com/wildcloud/wildcloud-websockets)
|
|
17
|
-
* [SockJS-cyclone](https://github.com/flaviogrossi/sockjs-cyclone)
|
|
18
|
-
* [SockJS-twisted](https://github.com/Fugiman/sockjs-twisted/)
|
|
19
|
-
* [wai-SockJS](https://github.com/Palmik/wai-sockjs)
|
|
20
|
-
* [SockJS-perl](https://github.com/vti/sockjs-perl)
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
SockJS-client
|
|
24
|
-
=============
|
|
25
|
-
|
|
26
|
-
SockJS is a browser JavaScript library that provides a WebSocket-like
|
|
27
|
-
object. SockJS gives you a coherent, cross-browser, Javascript API
|
|
28
|
-
which creates a low latency, full duplex, cross-domain communication
|
|
29
|
-
channel between the browser and the web server.
|
|
30
|
-
|
|
31
|
-
Under the hood SockJS tries to use native WebSockets first. If that
|
|
32
|
-
fails it can use a variety of browser-specific transport protocols and
|
|
33
|
-
presents them through WebSocket-like abstractions.
|
|
34
|
-
|
|
35
|
-
SockJS is intended to work for all modern browsers and in environments
|
|
36
|
-
which don't support WebSocket protcol, for example behind restrictive
|
|
37
|
-
corporate proxies.
|
|
38
|
-
|
|
39
|
-
SockJS-client does require a server counterpart:
|
|
40
|
-
|
|
41
|
-
* [SockJS-node](https://github.com/sockjs/sockjs-node) is a SockJS
|
|
42
|
-
server for Node.js.
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
Philosophy:
|
|
46
|
-
|
|
47
|
-
* The API should follow
|
|
48
|
-
[HTML5 Websockets API](http://dev.w3.org/html5/websockets/) as
|
|
49
|
-
closely as possible.
|
|
50
|
-
* All the transports must support cross domain connections out of the
|
|
51
|
-
box. It's possible and recommended to host SockJS server on
|
|
52
|
-
different server than your main web site.
|
|
53
|
-
* There is a support for at least one streaming protocol for every
|
|
54
|
-
major browser.
|
|
55
|
-
* Streaming transports should work cross-domain and
|
|
56
|
-
should support cookies (for cookie-based sticky sessions).
|
|
57
|
-
* Polling transports are be used as a fallback for old browsers and
|
|
58
|
-
hosts behind restrictive proxies.
|
|
59
|
-
* Connection establishment should be fast and lightweight.
|
|
60
|
-
* No Flash inside (no need to open port 843 - which doesn't work
|
|
61
|
-
through proxies, no need to host 'crossdomain.xml', no need
|
|
62
|
-
[to wait for 3 seconds](https://github.com/gimite/web-socket-js/issues/49)
|
|
63
|
-
in order to detect problems)
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
Subscribe to
|
|
67
|
-
[SockJS mailing list](https://groups.google.com/forum/#!forum/sockjs) for
|
|
68
|
-
discussions and support.
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
Live QUnit tests and smoke tests
|
|
72
|
-
--------------------------------
|
|
73
|
-
|
|
74
|
-
SockJS comes with some QUnit tests and a few smoke tests (using
|
|
75
|
-
[SockJS-node](https://github.com/sockjs/sockjs-client) on the server
|
|
76
|
-
side). At the moment they are deployed in few places:
|
|
77
|
-
|
|
78
|
-
* http://sockjs.popcnt.org/ and https://sockjs.popcnt.org/ (hosted in Europe)
|
|
79
|
-
* http://sockjs.cloudfoundry.com/ (CloudFoundry, websockets disabled, loadbalanced)
|
|
80
|
-
* https://sockjs.cloudfoundry.com/ (CloudFoundry SSL, websockets disabled, loadbalanced)
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
Example
|
|
84
|
-
-------
|
|
85
|
-
|
|
86
|
-
SockJS mimics [WebSockets API](http://dev.w3.org/html5/websockets/)
|
|
87
|
-
but instead of `WebSocket` there is a `SockJS` Javascript object.
|
|
88
|
-
|
|
89
|
-
First, you need to load SockJS JavaScript library, for example you can
|
|
90
|
-
put that in your http head:
|
|
91
|
-
|
|
92
|
-
<script src="http://cdn.sockjs.org/sockjs-0.3.min.js">
|
|
93
|
-
</script>
|
|
94
|
-
|
|
95
|
-
After the script is loaded you can establish a connection with the
|
|
96
|
-
SockJS server. Here's a simple example:
|
|
97
|
-
|
|
98
|
-
```javascript
|
|
99
|
-
<script>
|
|
100
|
-
var sock = new SockJS('http://mydomain.com/my_prefix');
|
|
101
|
-
sock.onopen = function() {
|
|
102
|
-
console.log('open');
|
|
103
|
-
};
|
|
104
|
-
sock.onmessage = function(e) {
|
|
105
|
-
console.log('message', e.data);
|
|
106
|
-
};
|
|
107
|
-
sock.onclose = function() {
|
|
108
|
-
console.log('close');
|
|
109
|
-
};
|
|
110
|
-
</script>
|
|
111
|
-
```
|
|
112
|
-
|
|
113
|
-
SockJS-client API
|
|
114
|
-
-----------------
|
|
115
|
-
|
|
116
|
-
### SockJS class
|
|
117
|
-
|
|
118
|
-
Similar to 'WebSocket' class 'SockJS' constructor takes one, or more arguments:
|
|
119
|
-
|
|
120
|
-
```javascript
|
|
121
|
-
var sockjs = new SockJS(url, _reserved, options);
|
|
122
|
-
```
|
|
123
|
-
|
|
124
|
-
Where `options` is a hash which can contain:
|
|
125
|
-
|
|
126
|
-
* **debug (boolean)**
|
|
127
|
-
|
|
128
|
-
Print some debugging messages using 'console.log'.
|
|
129
|
-
|
|
130
|
-
* **devel (boolean)**
|
|
131
|
-
|
|
132
|
-
Development mode. Currently setting it disables caching of the
|
|
133
|
-
'iframe.html'.
|
|
134
|
-
|
|
135
|
-
* **protocols_whitelist (list of strings)**
|
|
136
|
-
|
|
137
|
-
Sometimes it is useful to disable some fallback protocols. This
|
|
138
|
-
option allows you to supply a list protocols that may be used by
|
|
139
|
-
SockJS. By default all available protocols will be used, which is
|
|
140
|
-
equivalent to supplying: "['websocket', 'xdr-streaming', 'xhr-streaming',
|
|
141
|
-
'iframe-eventsource', 'iframe-htmlfile', 'xdr-polling', 'xhr-polling',
|
|
142
|
-
'iframe-xhr-polling', 'jsonp-polling']"
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
Although the 'SockJS' object tries to emulate the 'WebSocket'
|
|
146
|
-
behaviour, it's impossible to support all features. One of the
|
|
147
|
-
important SockJS limitations is the fact that you're not allowed to
|
|
148
|
-
open more than one SockJS connection to a single domain at a time.
|
|
149
|
-
This limitation is caused by a in-browser limit of outgoing
|
|
150
|
-
connections - usually [browsers don't allow opening more than two
|
|
151
|
-
outgoing connections to a single domain](http://stackoverflow.com/questions/985431/max-parallel-http-connections-in-a-browser). Single SockJS session
|
|
152
|
-
requires those two connections - one for downloading data, other for
|
|
153
|
-
sending messages. Opening second SockJS session at the same time
|
|
154
|
-
would most probably block and can result in both sessions timing out.
|
|
155
|
-
|
|
156
|
-
Opening more than one SockJS connection at a time is generally a
|
|
157
|
-
bad practice. If you absolutely must do it, you can use
|
|
158
|
-
mutliple subdomains, using different subdomain for every
|
|
159
|
-
SockJS connection.
|
|
160
|
-
|
|
161
|
-
Supported transports, by browser (html served from http:// or https://)
|
|
162
|
-
-----------------------------------------------------------------------
|
|
163
|
-
|
|
164
|
-
_Browser_ | _Websockets_ | _Streaming_ | _Polling_
|
|
165
|
-
----------------|------------------|-------------|-------------------
|
|
166
|
-
IE 6, 7 | no | no | jsonp-polling
|
|
167
|
-
IE 8, 9 (cookies=no) | no | xdr-streaming † | xdr-polling †
|
|
168
|
-
IE 8, 9 (cookies=yes)| no | iframe-htmlfile | iframe-xhr-polling
|
|
169
|
-
IE 10 | rfc6455 | xhr-streaming | xhr-polling
|
|
170
|
-
Chrome 6-13 | hixie-76 | xhr-streaming | xhr-polling
|
|
171
|
-
Chrome 14+ | hybi-10 / rfc6455| xhr-streaming | xhr-polling
|
|
172
|
-
Firefox <10 | no ‡ | xhr-streaming | xhr-polling
|
|
173
|
-
Firefox 10+ | hybi-10 / rfc6455| xhr-streaming | xhr-polling
|
|
174
|
-
Safari 5 | hixie-76 | xhr-streaming | xhr-polling
|
|
175
|
-
Opera 10.70+ | no ‡ | iframe-eventsource | iframe-xhr-polling
|
|
176
|
-
Konqueror | no | no | jsonp-polling
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
* **†**: IE 8+ supports [XDomainRequest][^9], which is
|
|
180
|
-
esentially a modified AJAX/XHR that can do requests across
|
|
181
|
-
domains. But unfortunately it doesn't send any cookies, which
|
|
182
|
-
makes it inaproppriate for deployments when the load balancer uses
|
|
183
|
-
JSESSIONID cookie to do sticky sessions.
|
|
184
|
-
|
|
185
|
-
* **‡**: Firefox 4.0 and Opera 11.00 and shipped with disabled
|
|
186
|
-
Websockets "hixie-76". They can still be enabled by manually
|
|
187
|
-
changing a browser setting.
|
|
188
|
-
|
|
189
|
-
Supported transports, by browser (html served from file://)
|
|
190
|
-
-----------------------------------------------------------
|
|
191
|
-
|
|
192
|
-
Sometimes you may want to serve your html from "file://" address - for
|
|
193
|
-
development or if you're using PhoneGap or similar technologies. But
|
|
194
|
-
due to the Cross Origin Policy files served from "file://" have no
|
|
195
|
-
Origin, and that means some of SockJS transports won't work. For this
|
|
196
|
-
reason the SockJS protocol table is different than usually, major
|
|
197
|
-
differences are:
|
|
198
|
-
|
|
199
|
-
_Browser_ | _Websockets_ | _Streaming_ | _Polling_
|
|
200
|
-
----------------|---------------|--------------------|-------------------
|
|
201
|
-
IE 8, 9 | same as above | iframe-htmlfile | iframe-xhr-polling
|
|
202
|
-
Other | same as above | iframe-eventsource | iframe-xhr-polling
|
|
203
|
-
|
|
204
|
-
Supported transports, by name
|
|
205
|
-
-----------------------------
|
|
206
|
-
|
|
207
|
-
_Transport_ | _References_
|
|
208
|
-
---------------------|---------------
|
|
209
|
-
websocket (rfc6455) | [rfc 6455][^10]
|
|
210
|
-
websocket (hixie-76) | [draft-hixie-thewebsocketprotocol-76][^1]
|
|
211
|
-
websocket (hybi-10) | [draft-ietf-hybi-thewebsocketprotocol-10][^2]
|
|
212
|
-
xhr-streaming | Transport using [Cross domain XHR][^5] [streaming][^7] capability (readyState=3).
|
|
213
|
-
xdr-streaming | Transport using [XDomainRequest][^9] [streaming][^7] capability (readyState=3).
|
|
214
|
-
iframe-eventsource | [EventSource][^4] used from an [iframe via postMessage][^3].
|
|
215
|
-
iframe-htmlfile | [HtmlFile][^8] used from an [iframe via postMessage][^3].
|
|
216
|
-
xhr-polling | Long-polling using [cross domain XHR][^5].
|
|
217
|
-
xdr-polling | Long-polling using [XDomainRequest][^9].
|
|
218
|
-
iframe-xhr-polling | Long-polling using normal AJAX from an [iframe via postMessage][^3].
|
|
219
|
-
jsonp-polling | Slow and old fashioned [JSONP polling][^6]. This transport will show "busy indicator" (aka: "spinning wheel") when sending data.
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
[^1]: http://tools.ietf.org/html/draft-hixie-thewebsocketprotocol-76
|
|
223
|
-
[^2]: http://tools.ietf.org/html/draft-ietf-hybi-thewebsocketprotocol-10
|
|
224
|
-
[^3]: https://developer.mozilla.org/en/DOM/window.postMessage
|
|
225
|
-
[^4]: http://dev.w3.org/html5/eventsource/
|
|
226
|
-
[^5]: https://secure.wikimedia.org/wikipedia/en/wiki/XMLHttpRequest#Cross-domain_requests
|
|
227
|
-
[^6]: https://secure.wikimedia.org/wikipedia/en/wiki/JSONP
|
|
228
|
-
[^7]: http://www.debugtheweb.com/test/teststreaming.aspx
|
|
229
|
-
[^8]: http://cometdaily.com/2007/11/18/ie-activexhtmlfile-transport-part-ii/
|
|
230
|
-
[^9]: http://blogs.msdn.com/b/ieinternals/archive/2010/05/13/xdomainrequest-restrictions-limitations-and-workarounds.aspx
|
|
231
|
-
[^10]: http://www.rfc-editor.org/rfc/rfc6455.txt
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
Connecting to SockJS without the client
|
|
235
|
-
---------------------------------------
|
|
236
|
-
|
|
237
|
-
Although the main point of SockJS it to enable browser-to-server
|
|
238
|
-
connectivity, it is possible to connect to SockJS from an external
|
|
239
|
-
application. Any SockJS server complying with 0.3 protocol does
|
|
240
|
-
support a raw WebSocket url. The raw WebSocket url for the test server
|
|
241
|
-
looks like:
|
|
242
|
-
|
|
243
|
-
* ws://localhost:8081/echo/websocket
|
|
244
|
-
|
|
245
|
-
You can connect any WebSocket RFC 6455 compliant WebSocket client to
|
|
246
|
-
this url. This can be a command line client, external application,
|
|
247
|
-
third party code or even a browser (though I don't know why you would
|
|
248
|
-
want to do so).
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
Deployment
|
|
252
|
-
----------
|
|
253
|
-
|
|
254
|
-
In order to utilize best performance you should use the SockJS-client
|
|
255
|
-
releases hosted on SockJS CDN. You should use a version of sockjs-client
|
|
256
|
-
that supports the protocol used by your server. For example:
|
|
257
|
-
|
|
258
|
-
<script src="http://cdn.sockjs.org/sockjs-0.3.min.js">
|
|
259
|
-
</script>
|
|
260
|
-
|
|
261
|
-
A list of files hosted on a CDN is available here: http://sockjs.github.com/sockjs-client/ .
|
|
262
|
-
|
|
263
|
-
You can also use or CDN via https (using Cloud Front domain name):
|
|
264
|
-
|
|
265
|
-
<script src="https://d1fxtkz8shb9d2.cloudfront.net/sockjs-0.3.js">
|
|
266
|
-
</script>
|
|
267
|
-
|
|
268
|
-
For server-side deployment tricks, especially about load balancing and
|
|
269
|
-
session stickiness, take a look at the
|
|
270
|
-
[SockJS-node readme](https://github.com/sockjs/sockjs-node#readme).
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
Development and testing
|
|
274
|
-
-----------------------
|
|
275
|
-
|
|
276
|
-
SockJS-client needs [Node.js](http://nodejs.org/) for running a test
|
|
277
|
-
server and JavaScript minification. If you want to work on
|
|
278
|
-
SockJS-client source code, check out the git repo and follow this
|
|
279
|
-
steps:
|
|
280
|
-
|
|
281
|
-
cd sockjs-client
|
|
282
|
-
npm install
|
|
283
|
-
npm install --dev
|
|
284
|
-
|
|
285
|
-
To generate JavaScript run:
|
|
286
|
-
|
|
287
|
-
make sockjs.js
|
|
288
|
-
|
|
289
|
-
To generate minified JavaScript run:
|
|
290
|
-
|
|
291
|
-
make sockjs.min.js
|
|
292
|
-
|
|
293
|
-
(To generate both run `make build`.)
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
### Testing
|
|
297
|
-
|
|
298
|
-
Once you compiled SockJS-client you may want to check if your changes
|
|
299
|
-
pass all the tests. To run the tests you need a server that can answer
|
|
300
|
-
various SockJS requests. A common way is to use `SockJS-node` test
|
|
301
|
-
server for that. To run it (by default it will be listening on port 8081):
|
|
302
|
-
|
|
303
|
-
cd sockjs-node
|
|
304
|
-
npm install
|
|
305
|
-
npm install --dev
|
|
306
|
-
make build
|
|
307
|
-
make test_server
|
|
308
|
-
|
|
309
|
-
At this point you're ready to run a SockJS-client server that will
|
|
310
|
-
server your freshly compiled JavaScript and various static http and
|
|
311
|
-
javscript files (by default it will run on port 8080).
|
|
312
|
-
|
|
313
|
-
cd sockjs-client
|
|
314
|
-
make test
|
|
315
|
-
|
|
316
|
-
At that point you should have two web servers running: sockjs-node on
|
|
317
|
-
8081 and sockjs-client on 8080. When you open the browser on
|
|
318
|
-
[http://localhost:8080/](http://localhost:8080/) you should be able
|
|
319
|
-
run the QUnit tests against your sockjs-node server.
|
|
320
|
-
|
|
321
|
-
If you look at your browser console you will see warnings like that:
|
|
322
|
-
|
|
323
|
-
Incompatibile SockJS! Main site uses: "a", the iframe: "b".
|
|
324
|
-
|
|
325
|
-
This is due to a fact that SockJS-node test server is using compiled
|
|
326
|
-
javascript from CDN, rather than your freshly compiled version. To fix
|
|
327
|
-
that you must amend `sockjs_url` that is used by SockJS-node test
|
|
328
|
-
server. Edit the [`config.js`](https://github.com/sockjs/sockjs-node/blob/master/examples/test_server/config.js) file:
|
|
329
|
-
|
|
330
|
-
vim sockjs-node/examples/test_server/config.js
|
|
331
|
-
|
|
332
|
-
And replace `sockjs_url` setting which by default points to CDN:
|
|
333
|
-
|
|
334
|
-
sockjs_url: 'http://cdn.sockjs.org/sockjs-0.3.min.js',
|
|
335
|
-
|
|
336
|
-
to a freshly compiled sockjs, for example:
|
|
337
|
-
|
|
338
|
-
sockjs_url: 'http://localhost:8080/lib/sockjs.js',
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
Also, if you want to run tests agains SockJS server not running on
|
|
342
|
-
`localhost:8081` you may want to edit the
|
|
343
|
-
[`tests/config.js`](https://github.com/sockjs/sockjs-client/blob/master/tests/config.js)
|
|
344
|
-
file.
|
|
345
|
-
|
|
346
|
-
Additionally, if you're doing more serious development consider using
|
|
347
|
-
`make serve`, which will automatically reload the server when you
|
|
348
|
-
modify the source code.
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
Browser Quirks
|
|
352
|
-
--------------
|
|
353
|
-
|
|
354
|
-
There are various browser quirks which we don't intend to address:
|
|
355
|
-
|
|
356
|
-
* Pressing ESC in Firefox closes SockJS connection. For a workaround
|
|
357
|
-
and discussion see [#18](https://github.com/sockjs/sockjs-client/issues/18).
|
|
358
|
-
* Jsonp-polling transport will show a "spinning wheel" (aka. "busy indicator")
|
|
359
|
-
when sending data.
|
|
360
|
-
* You can't open more than one SockJS connection to one domain at the
|
|
361
|
-
same time due to [the browsers limit of consurrent connections](http://stackoverflow.com/questions/985431/max-parallel-http-connections-in-a-browser)
|
|
362
|
-
(this limit is not counting native websockets connections).
|
|
363
|
-
* Although SockJS is trying to escape any strange Unicode characters
|
|
364
|
-
(even invalid ones - [like surrogates \xD800-\xDBFF](http://en.wikipedia.org/wiki/Mapping_of_Unicode_characters#Surrogates) or [\xFFFE and \xFFFF](https://en.wikipedia.org/wiki/Unicode#Character_General_Category))
|
|
365
|
-
it's advisable to use only valid characters. Using invalid
|
|
366
|
-
characters is a bit slower, and may not work with SockJS servers
|
|
367
|
-
that have a proper Unicode support.
|
|
368
|
-
* Having a global function called `onmessage` or such is probably a
|
|
369
|
-
bad idea, as it could be called by the built-in `postMessage` API.
|
|
370
|
-
* From SockJS point of view there is nothing special about
|
|
371
|
-
SSL/HTTPS. Connecting between unencrypted and encrypted sites
|
|
372
|
-
should work just fine.
|
|
373
|
-
* Although SockJS does best to support both prefix and cookie based
|
|
374
|
-
sticky sessions, the latter may not work well cross-domain with
|
|
375
|
-
browsers that don't accept third-party cookies by default (Safari).
|
|
376
|
-
In order to get around this make sure you're connecting to sockjs
|
|
377
|
-
from the same parent domain as the main site. For example
|
|
378
|
-
'sockjs.a.com' is able to set cookies if you're connecting from
|
|
379
|
-
'www.a.com' or 'a.com'.
|
|
380
|
-
* Trying to connect from secure "https://" to insecure "http://" is
|
|
381
|
-
not good idea. The other way around should be fine.
|
|
382
|
-
* Long polling is known to cause problems on Heroku, but
|
|
383
|
-
[workaround for SockJS is available](https://github.com/sockjs/sockjs-node/issues/57#issuecomment-5242187).
|
|
384
|
-
* Don't use "javascript:" links on a page that uses SockJS. For
|
|
385
|
-
some reason clickling on this type of link breaks XDR/XHR requests
|
|
386
|
-
on IE (see [#90](https://github.com/sockjs/sockjs-client/issues/90)).
|
|
387
|
-
* SockJS [websocket transport is more stable over SSL](https://github.com/sockjs/sockjs-client/issues/94). If you're a serious SockJS user consider using SSL.
|
|
388
|
-
over SSL](https://github.com/sockjs/sockjs-client/issues/94).
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
#!/bin/sh
|
|
2
|
-
|
|
3
|
-
LF='
|
|
4
|
-
'
|
|
5
|
-
|
|
6
|
-
VN=$(git describe --match "v[0-9]*" --abbrev=4 HEAD 2>/dev/null)
|
|
7
|
-
case "$VN" in
|
|
8
|
-
*$LF*) (exit 1) ;;
|
|
9
|
-
v[0-9]*)
|
|
10
|
-
git update-index -q --refresh
|
|
11
|
-
test -z "$(git diff-index --name-only HEAD --)" ||
|
|
12
|
-
VN="$VN-dirty" ;;
|
|
13
|
-
esac
|
|
14
|
-
VN=$(echo "$VN" | sed -e 's/-/./g');
|
|
15
|
-
VN=$(expr "$VN" : v*'\(.*\)')
|
|
16
|
-
|
|
17
|
-
echo "$VN"
|
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env coffee
|
|
2
|
-
#
|
|
3
|
-
# ***** BEGIN LICENSE BLOCK *****
|
|
4
|
-
# Copyright (c) 2011-2012 VMware, Inc.
|
|
5
|
-
#
|
|
6
|
-
# For the license see COPYING.
|
|
7
|
-
# ***** END LICENSE BLOCK *****
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
fs = require('fs')
|
|
11
|
-
uglify = require('uglify-js')
|
|
12
|
-
optparse = require('optparse')
|
|
13
|
-
|
|
14
|
-
array_flatten = (arr, acc) ->
|
|
15
|
-
if typeof acc is 'undefined'
|
|
16
|
-
acc = []
|
|
17
|
-
if typeof arr is 'string'
|
|
18
|
-
acc.push(arr)
|
|
19
|
-
return acc
|
|
20
|
-
|
|
21
|
-
if arr.constructor isnt Array
|
|
22
|
-
throw "Value is not an Array nor a String!"
|
|
23
|
-
|
|
24
|
-
for v in arr
|
|
25
|
-
if typeof v is 'string'
|
|
26
|
-
acc.push(v)
|
|
27
|
-
else if v.constructor is Array
|
|
28
|
-
array_flatten(v, acc)
|
|
29
|
-
else
|
|
30
|
-
throw "Value is not an Array nor a String!"
|
|
31
|
-
return acc
|
|
32
|
-
|
|
33
|
-
stringify_unicode = (str) ->
|
|
34
|
-
str = str.replace /[\u0100-\uffff]/g, (ch) ->
|
|
35
|
-
return "\\u" + ('0000' + ch.charCodeAt(0).toString(16)).substr(-4)
|
|
36
|
-
str = str.replace /[\x00-\x08\x0b-\x1f\x7f-\xff]/g, (ch) ->
|
|
37
|
-
return "\\x" + ('00' + ch.charCodeAt(0).toString(16)).substr(-2)
|
|
38
|
-
return str
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
minify = (data, minify_options)->
|
|
42
|
-
ast = uglify.parser.parse(data)
|
|
43
|
-
ast = uglify.uglify.ast_mangle(ast, minify_options)
|
|
44
|
-
ast = uglify.uglify.ast_squeeze(ast)
|
|
45
|
-
uglify.uglify.gen_code(ast, minify_options)
|
|
46
|
-
|
|
47
|
-
render = (filename, depth, options) ->
|
|
48
|
-
tags =
|
|
49
|
-
include: (args) ->
|
|
50
|
-
if (args.length > 1 and args[1].indexOf('c') isnt -1 and
|
|
51
|
-
options.minify is false)
|
|
52
|
-
options.comment = true
|
|
53
|
-
render(args[0], depth + ' ', options)
|
|
54
|
-
version: ->
|
|
55
|
-
options.version
|
|
56
|
-
include_and_minify: (args) ->
|
|
57
|
-
if (args.length > 1 and args[1].indexOf('c') isnt -1 and
|
|
58
|
-
options.minify is false)
|
|
59
|
-
options.comment = true
|
|
60
|
-
d = render(args[0], depth + ' ', options)
|
|
61
|
-
if options.minify
|
|
62
|
-
return minify(array_flatten(d).join(''), options)
|
|
63
|
-
return d
|
|
64
|
-
|
|
65
|
-
console.warn(depth + " [.] Rendering", filename)
|
|
66
|
-
|
|
67
|
-
# no trailing whitespace
|
|
68
|
-
data = fs.readFileSync(filename, encoding='utf8').replace(/\s+$/, '')
|
|
69
|
-
|
|
70
|
-
content = []
|
|
71
|
-
if options.comment
|
|
72
|
-
content.push('\n// ' + depth + '[*] Including ' + filename + '\n')
|
|
73
|
-
|
|
74
|
-
elements = data.split(/<!--\s*([^>]+)\s*-->/g)
|
|
75
|
-
for i in [0...elements.length]
|
|
76
|
-
e = elements[i];
|
|
77
|
-
if i % 2 is 0
|
|
78
|
-
content.push(e)
|
|
79
|
-
else
|
|
80
|
-
p = e.split(' ')
|
|
81
|
-
content.push( tags[p[0]](p.slice(1)) )
|
|
82
|
-
|
|
83
|
-
if options.comment
|
|
84
|
-
content.push('\n// ' + depth + '[*] End of ' + filename + '\n')
|
|
85
|
-
return content
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
main = ->
|
|
89
|
-
switches = [
|
|
90
|
-
['-p', '--pretty', 'Prettify javascript']
|
|
91
|
-
['-m', '--minify', 'Minify javascript']
|
|
92
|
-
['-s', '--set-version [VERSION]', 'Set the value of version tag']
|
|
93
|
-
]
|
|
94
|
-
options = {minify: false, toplevel: true, version: 'unknown'}
|
|
95
|
-
parser = new optparse.OptionParser(switches)
|
|
96
|
-
parser.on 'pretty', ->
|
|
97
|
-
options.beautify = true
|
|
98
|
-
parser.on 'minify', ->
|
|
99
|
-
options.minify = true
|
|
100
|
-
parser.on 'set-version', (_, version) ->
|
|
101
|
-
options.version = version
|
|
102
|
-
filenames = parser.parse((process.ARGV || process.argv).slice(2))
|
|
103
|
-
|
|
104
|
-
content = for filename in filenames
|
|
105
|
-
render(filename, '', options)
|
|
106
|
-
content.push('\n')
|
|
107
|
-
process.stdout.write(
|
|
108
|
-
stringify_unicode(array_flatten(content).join('')),
|
|
109
|
-
'utf8')
|
|
110
|
-
|
|
111
|
-
main()
|
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
# Include a script with credentails:
|
|
3
|
-
. .testling_env.sh
|
|
4
|
-
# This script should set few Testling variables and should look more
|
|
5
|
-
# or less like that:
|
|
6
|
-
#
|
|
7
|
-
# TESTLING_CRED=my@email.com:password
|
|
8
|
-
# TUNNEL_PORT=12345
|
|
9
|
-
# TUNNEL_USER=my_email_com
|
|
10
|
-
#
|
|
11
|
-
# First, you need to create browserling.com account. Set TESTLING_CRED
|
|
12
|
-
# to email:password. Additionally, you must create a testling tunnel
|
|
13
|
-
# using commands like that:
|
|
14
|
-
#
|
|
15
|
-
# curl -u $TESTLING_CRED "testling.com/tunnel" -sST ~/.ssh/id_rsa.pub
|
|
16
|
-
# curl -u $TESTLING_CRED "testling.com/tunnel/open"
|
|
17
|
-
#
|
|
18
|
-
# After that set TUNNEL_PORT and TUNNEL_USER accordingly.
|
|
19
|
-
#
|
|
20
|
-
#
|
|
21
|
-
|
|
22
|
-
browsers=(
|
|
23
|
-
# iexplore/6.0
|
|
24
|
-
# iexplore/7.0
|
|
25
|
-
# iexplore/8.0
|
|
26
|
-
# iexplore/9.0
|
|
27
|
-
# chrome/4.0
|
|
28
|
-
# chrome/5.0
|
|
29
|
-
# chrome/6.0
|
|
30
|
-
# chrome/7.0
|
|
31
|
-
# chrome/8.0
|
|
32
|
-
# chrome/9.0
|
|
33
|
-
# chrome/10.0
|
|
34
|
-
# chrome/11.0
|
|
35
|
-
# chrome/12.0
|
|
36
|
-
# chrome/13.0
|
|
37
|
-
# chrome/14.0
|
|
38
|
-
# chrome/15.0
|
|
39
|
-
chrome/canary
|
|
40
|
-
# firefox/3.0
|
|
41
|
-
# firefox/3.5
|
|
42
|
-
# firefox/3.6
|
|
43
|
-
# firefox/4.0
|
|
44
|
-
# firefox/5.0
|
|
45
|
-
# firefox/6.0
|
|
46
|
-
# firefox/7.0
|
|
47
|
-
# firefox/8.0
|
|
48
|
-
# firefox/nightly
|
|
49
|
-
# opera/10.0
|
|
50
|
-
# opera/10.5
|
|
51
|
-
# opera/11.0
|
|
52
|
-
# opera/11.5
|
|
53
|
-
# opera/next
|
|
54
|
-
# safari/5.0.5
|
|
55
|
-
# safari/5.1
|
|
56
|
-
)
|
|
57
|
-
|
|
58
|
-
BROWSERS=`echo ${browsers[@]}|tr ' ' ','`
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
if [ "$TESTLING_CRED" = "" ] || \
|
|
62
|
-
[ "$TUNNEL_PORT" = "" ] || \
|
|
63
|
-
[ "$TUNNEL_USER" = "" ]; then
|
|
64
|
-
echo "Error: Please set following env variables: "\
|
|
65
|
-
"TESTLING_CRED TUNNEL_PORT TUNNEL_USER"
|
|
66
|
-
exit 1
|
|
67
|
-
fi
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
PIDFILE=.sshpidfile.pid
|
|
71
|
-
|
|
72
|
-
if [ -e $PIDFILE ]; then
|
|
73
|
-
kill `cat $PIDFILE`
|
|
74
|
-
rm $PIDFILE
|
|
75
|
-
fi
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
cat > testling.js << EOF
|
|
80
|
-
var test = require('testling');
|
|
81
|
-
test('Testling Test Runner', function (t) {
|
|
82
|
-
t.createWindow('http://tunnel.browserling.com:$TUNNEL_PORT/unittests.html',
|
|
83
|
-
function(win, jq) {
|
|
84
|
-
jq(function() {
|
|
85
|
-
if(typeof win.QUnit === 'undefined') {
|
|
86
|
-
t.log("No QUnit object in the window!");
|
|
87
|
-
t.end();
|
|
88
|
-
} else {
|
|
89
|
-
var q = win.QUnit;
|
|
90
|
-
var module_name = '[unknown]';
|
|
91
|
-
q.begin = function() {
|
|
92
|
-
t.log(' [*] Start');
|
|
93
|
-
};
|
|
94
|
-
q.moduleStart = function(o) {
|
|
95
|
-
module_name = o.name;
|
|
96
|
-
};
|
|
97
|
-
q.log = function(o) {
|
|
98
|
-
var x = module_name + ': ' + o.message;
|
|
99
|
-
t.ok(o.result, x);
|
|
100
|
-
if(!o.result) {
|
|
101
|
-
t.log(" [-] Failed: " + x);
|
|
102
|
-
}
|
|
103
|
-
};
|
|
104
|
-
q.done = function(o) {
|
|
105
|
-
t.log(' [*] Done ' + o.failed + ' ' + o.passed +
|
|
106
|
-
' ' + o.total + ' ' + o.runtime);
|
|
107
|
-
t.end();
|
|
108
|
-
};
|
|
109
|
-
}
|
|
110
|
-
});
|
|
111
|
-
});
|
|
112
|
-
// Dead man's switch
|
|
113
|
-
setTimeout(function(){
|
|
114
|
-
t.log("Emergency timeout ocurred");
|
|
115
|
-
t.end();
|
|
116
|
-
}, 5000);
|
|
117
|
-
});
|
|
118
|
-
EOF
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
ssh -o "VerifyHostKeyDNS no" \
|
|
123
|
-
-NR $TUNNEL_PORT:localhost:8080 $TUNNEL_USER@tunnel.browserling.com &
|
|
124
|
-
SSHPID=$!
|
|
125
|
-
echo $SSHPID > $PIDFILE
|
|
126
|
-
|
|
127
|
-
echo "[*] Running against: ${browsers[@]}"
|
|
128
|
-
curl -u $TESTLING_CRED -sSNT testling.js \
|
|
129
|
-
"testling.com/?browsers=$BROWSERS&noinstrument=test.js"
|
|
130
|
-
|
|
131
|
-
kill $SSHPID
|
|
132
|
-
wait $SSHPID
|
|
133
|
-
rm $PIDFILE
|
|
134
|
-
|
|
135
|
-
curl -sSNu $TESTLING_CRED "testling.com/browsers"|tail -n 1
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name" : "sockjs-client",
|
|
3
|
-
"author" : "Marek Majkowski",
|
|
4
|
-
"version" : "0.0.0-unreleasable",
|
|
5
|
-
"description" : "SockJS-client is a browser JavaScript library that provides a WebSocket-like object. SockJS gives you a coherent, cross-browser, Javascript API which creates a low latency, full duplex, cross-domain communication channel between the browser and the web server.",
|
|
6
|
-
"keywords" : ["websockets", "websocket"],
|
|
7
|
-
"homepage" : "http://sockjs.org",
|
|
8
|
-
|
|
9
|
-
"repository": {"type" : "git",
|
|
10
|
-
"url" : "https://github.com/sockjs/sockjs-client.git"},
|
|
11
|
-
"devDependencies": {
|
|
12
|
-
"uglify-js" : "1.2.5",
|
|
13
|
-
"coffee-script" : "1.2.x",
|
|
14
|
-
"optparse" : "1.0.3",
|
|
15
|
-
"node-static" : "0.5.9"
|
|
16
|
-
},
|
|
17
|
-
"main": "sockjs.js"
|
|
18
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
0.3.4
|