4
4
[ ![ npm version] ( https://img.shields.io/npm/v/sockjs-client.svg?style=flat-square )] ( https://www.npmjs.com/package/sockjs-client ) [ ![ Build Status] ( https://img.shields.io/travis/sockjs/sockjs-client/master.svg?style=flat-square )] ( https://travis-ci.org/sockjs/sockjs-client ) [ ![ Dependencies] ( https://img.shields.io/david/sockjs/sockjs-client.svg?style=flat-square )] ( https://david-dm.org/sockjs/sockjs-client ) [ ![ Chat] ( https://img.shields.io/badge/Chat-gitter.im-blue.svg?style=flat-square )] ( https://gitter.im/sockjs/sockjs-client )
5
5
[ ![ BrowserStack Status] ( https://www.browserstack.com/automate/badge.svg?badge_key=dW9YdlFsSEI5VzNBVVk5ZS9XT0xaTjJVQkhQMkRkNlZBQURiSWNWMC9jaz0tLXRJM05RbW1tTCt5TlhHaVgycFJUYmc9PQ==--e3ef9b9a9fa071084e6d87874b5fc65b71273821 )] ( https://www.browserstack.com/automate/public-build/dW9YdlFsSEI5VzNBVVk5ZS9XT0xaTjJVQkhQMkRkNlZBQURiSWNWMC9jaz0tLXRJM05RbW1tTCt5TlhHaVgycFJUYmc9PQ==--e3ef9b9a9fa071084e6d87874b5fc65b71273821 )
6
6
7
+ # Supporting SockJS
8
+
9
+ Tidelift gives software development teams a single source for purchasing and maintaining their software, with professional grade assurances from the experts who know it best, while seamlessly integrating with existing tools.
10
+
11
+ [ Get supported sockjs-client with the Tidelift Subscription] ( https://tidelift.com/subscription/pkg/npm-sockjs-client?utm_source=npm-sockjs-client&utm_medium=referral&utm_campaign=readme )
12
+
13
+ # Summary
14
+
7
15
SockJS is a browser JavaScript library that provides a WebSocket-like
8
16
object. SockJS gives you a coherent, cross-browser, Javascript API
9
17
which creates a low latency, full duplex, cross-domain communication
@@ -48,7 +56,7 @@ Subscribe to
48
56
[ SockJS mailing list] ( https://groups.google.com/forum/#!forum/sockjs ) for
49
57
discussions and support.
50
58
51
- SockJS family:
59
+ # SockJS family
52
60
53
61
* [ SockJS-client] ( https://github.com/sockjs/sockjs-client ) JavaScript client library
54
62
* [ SockJS-node] ( https://github.com/sockjs/sockjs-node ) Node.js server
@@ -75,8 +83,7 @@ Work in progress:
75
83
* [ SockJS-go] ( https://github.com/igm/sockjs-go/ )
76
84
* [ syp.biz.SockJS.NET] ( https://github.com/sypbiz/SockJS.NET ) - .NET port of the SockJS client
77
85
78
- Getting Started
79
- -------
86
+ # Getting Started
80
87
81
88
SockJS mimics the [ WebSockets API] ( https://www.w3.org/TR/websockets/ ) ,
82
89
but instead of ` WebSocket ` there is a ` SockJS ` Javascript object.
@@ -109,10 +116,9 @@ SockJS server. Here's a simple example:
109
116
110
117
```
111
118
112
- SockJS-client API
113
- -----------------
119
+ # SockJS-client API
114
120
115
- ### SockJS class
121
+ ## SockJS class
116
122
117
123
Similar to the 'WebSocket' API, the 'SockJS' constructor takes one, or more arguments:
118
124
@@ -162,8 +168,7 @@ bad practice. If you absolutely must do it, you can use
162
168
multiple subdomains, using a different subdomain for every
163
169
SockJS connection.
164
170
165
- Supported transports, by browser (html served from http:// or https://)
166
- -----------------------------------------------------------------------
171
+ # Supported transports, by browser (html served from http:// or https://)
167
172
168
173
_ Browser_ | _ Websockets_ | _ Streaming_ | _ Polling_
169
174
----------------|------------------|-------------|-------------------
@@ -192,8 +197,7 @@ Konqueror | no | no | jsonp-polling
192
197
Websockets "hixie-76". They can still be enabled by manually
193
198
changing a browser setting.
194
199
195
- Supported transports, by browser (html served from file://)
196
- -----------------------------------------------------------
200
+ # Supported transports, by browser (html served from file://)
197
201
198
202
Sometimes you may want to serve your html from "file://" address - for
199
203
development or if you're using PhoneGap or similar technologies. But
@@ -207,8 +211,7 @@ _Browser_ | _Websockets_ | _Streaming_ | _Polling_
207
211
IE 8, 9 | same as above | iframe-htmlfile | iframe-xhr-polling
208
212
Other | same as above | iframe-eventsource | iframe-xhr-polling
209
213
210
- Supported transports, by name
211
- -----------------------------
214
+ # Supported transports, by name
212
215
213
216
_ Transport_ | _ References_
214
217
---------------------|---------------
@@ -239,8 +242,7 @@ jsonp-polling | Slow and old fashioned [JSONP polling][^6]. This transpor
239
242
[ ^ 10 ] : https://www.rfc-editor.org/rfc/rfc6455.txt
240
243
241
244
242
- Connecting to SockJS without the client
243
- ---------------------------------------
245
+ # Connecting to SockJS without the client
244
246
245
247
Although the main point of SockJS is to enable browser-to-server
246
248
connectivity, it is possible to connect to SockJS from an external
@@ -256,8 +258,7 @@ third party code or even a browser (though I don't know why you would
256
258
want to do so).
257
259
258
260
259
- Deployment
260
- ----------
261
+ # Deployment
261
262
262
263
You should use a version of sockjs-client
263
264
that supports the protocol used by your server. For example:
@@ -272,8 +273,7 @@ session stickiness, take a look at the
272
273
[ SockJS-node readme] ( https://github.com/sockjs/sockjs-node#readme ) .
273
274
274
275
275
- Development and testing
276
- -----------------------
276
+ # Development and testing
277
277
278
278
SockJS-client needs [ node.js] ( https://nodejs.org/ ) for running a test
279
279
server and JavaScript minification. If you want to work on
@@ -293,7 +293,7 @@ To generate minified JavaScript, run:
293
293
294
294
Both commands output into the ` build ` directory.
295
295
296
- ### Testing
296
+ ## Testing
297
297
298
298
Automated testing provided by:
299
299
@@ -306,8 +306,7 @@ pass all the tests.
306
306
307
307
This will start [ karma] ( https://karma-runner.github.io ) and a test support server.
308
308
309
- Browser Quirks
310
- --------------
309
+ # Browser Quirks
311
310
312
311
There are various browser quirks which we don't intend to address:
313
312
0 commit comments