Skip to content

Commit d1039a6

Browse files
committed
Cleanup and Grammar
1 parent 2968160 commit d1039a6

15 files changed

+166
-978
lines changed

_config.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,6 @@ footer:
8787
- label: 'rx-stomp'
8888
icon: 'fab fa-fw fa-github'
8989
url: 'https://github.com/stomp-js/rx-stomp'
90-
- label: 'ng2-stompjs'
91-
icon: 'fab fa-fw fa-github'
92-
url: 'https://github.com/stomp-js/ng2-stompjs'
9390

9491
# Reading Files
9592
encoding: 'utf-8'

_posts/2018-06-28-pollyfils-for-stompjs-v5.md

Lines changed: 0 additions & 127 deletions
This file was deleted.
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
---
2+
layout: single
3+
title: 'StompJs v5+, RxStomp: Polyfills'
4+
date: 2018-06-29 07:59:22 +0530
5+
categories: guide stompjs rx-stomp
6+
toc: true
7+
redirect_from:
8+
- /guide/stompjs/rx-stomp/ng2-stompjs/2018/06/28/pollyfils-for-stompjs-v5.html
9+
- /guide/stompjs/rx-stomp/ng2-stompjs/2018/06/29/pollyfils-for-stompjs-v5.html
10+
- /guide/stompjs/rx-stomp/ng2-stompjs/2018/06/30/pollyfils-for-stompjs-v5.html
11+
- /guide/stompjs/rx-stomp/ng2-stompjs/pollyfils-for-stompjs-v5.html
12+
---
13+
14+
This guide covers critical dependencies and polyfills for version 5+ of `@stomp/stompjs`;
15+
which is internally used by `@stomp/rx-stomp` as well.
16+
17+
## In NodeJS
18+
19+
### WebSocket
20+
21+
There are two alternate libraries `websocket` and `ws` which have been reported to work.
22+
23+
#### websocket
24+
25+
- Add `websocket` npm module:
26+
27+
```bash
28+
$ npm install websocket
29+
```
30+
31+
- Using `import` syntax
32+
33+
```javascript
34+
import websocket from 'websocket';
35+
36+
Object.assign(global, { WebSocket: websocket.w3cwebsocket });
37+
```
38+
39+
#### ws
40+
41+
- Instead of `websocket` lib `ws` has also been reported to work.
42+
See: [stompjs/issues/28](https://github.com/stomp-js/stompjs/issues/28).
43+
- Add `ws` npm module:
44+
45+
```bash
46+
$ npm install ws
47+
```
48+
49+
- Require the module and expose it through `global`
50+
51+
```javascript
52+
import { WebSocket } from 'ws';
53+
54+
Object.assign(global, { WebSocket });
55+
```
56+
57+
## In React Native
58+
59+
### TextEncoder/TextDecoder
60+
61+
- React Native makes it deceptive.
62+
When an application is executed in debug mode, it works, as it is executed on an actual browser
63+
where TextEncoder/TextDecoder is available.
64+
However, when executed in production mode, it fails as TextEncoder/TextDecoder is not available.
65+
- Please install `text-encoding`
66+
```bash
67+
$ npm install text-encoding
68+
```
69+
- Add the following to your `index.js` or `App.js`:
70+
71+
```javascript
72+
import * as encoding from 'text-encoding';
73+
```
74+
75+
- There are additional issues with React Native in some device/version combinations. Please see:
76+
[React Native - Additional Notes](/workaround/stompjs/rx-stomp/ng2-stompjs/react-native-additional-notes.html)

_posts/2018-06-29-using-stompjs-v5.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ This npm distribution has a UMD package and ES6 modules. The web browsers will u
2222

2323
### Polyfills
2424

25-
_Important: before using, please check [Polyfills & Critical Dependencies]._
25+
_Important: For NodeJS and React Native, please check [Polyfills]._
2626

2727
### In Web Browser
2828

@@ -391,5 +391,5 @@ The above also allows adjusting [Client#reconnectDelay](/api-docs/latest/classes
391391

392392
Even [Client#brokerURL](/api-docs/latest/classes/Client.html#brokerURL) or [Client#connectHeaders](/api-docs/latest/classes/Client.html#connectHeaders) can be altered which would get used in a subsequent reconnect.
393393

394-
[Polyfills & Critical Dependencies]: {% link _posts/2018-06-28-pollyfils-for-stompjs-v5.md %}
394+
[Polyfills]: {% link _posts/2018-06-28-polyfills-for-stompjs.md %}
395395
[Uint8Array]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array

_posts/2018-09-08-upgrading-stompjs.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ redirect_from:
1212

1313
## Upgrading from version 3/4
1414

15-
_Important: before upgrading please check [Polyfills & Critical Dependencies]._
15+
_Important: For NodeJS and React Native, please check [Polyfills]._
1616

1717
### Basic changes
1818

@@ -197,4 +197,4 @@ Additional notes:
197197
- If you are using `SockJS` please also see [SockJS support]
198198

199199
[SockJS support]: {% link _posts/2018-09-10-using-stomp-with-sockjs.md %}
200-
[Polyfills & Critical Dependencies]: {% link _posts/2018-06-28-pollyfils-for-stompjs-v5.md %}
200+
[Polyfills]: {% link _posts/2018-06-28-polyfills-for-stompjs.md %}

_posts/2018-09-10-using-stomp-with-sockjs.md

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,20 @@
22
layout: single
33
title: 'Using STOMP with SockJS'
44
date: 2018-09-10 12:06:34 +0530
5-
categories: guide stompjs rx-stomp ng2-stompjs
5+
categories: guide stompjs rx-stomp
66
toc: true
77
redirect_from:
88
- /guide/stompjs/rx-stomp/ng2-stompjs/2018/09/09/using-stomp-with-sockjs.html
99
- /guide/stompjs/rx-stomp/ng2-stompjs/2018/09/10/using-stomp-with-sockjs.html
1010
- /guide/stompjs/rx-stomp/ng2-stompjs/2018/09/11/using-stomp-with-sockjs.html
11+
- /guide/stompjs/rx-stomp/ng2-stompjs/using-stomp-with-sockjs.html
1112
---
1213

14+
**There are a large number of obsolete (and copied from one another)
15+
examples for these libraries that use SockJS.
16+
In reality, there is very little chance that you need SockJS.
17+
Unless you know, for sure, you do not need SockJS.**
18+
1319
This guide covers how to use [SockJS client] instead of WebSockets as underlying transport.
1420

1521
**For Spring STOMP users:**
@@ -18,19 +24,18 @@ That is incorrect, you only need SockJS if you need to support old browsers._
1824

1925
## Do you need SockJS?
2026

21-
As of 2018, WebSocket support in browsers is nearly ubiquitous.
27+
As of 2018, WebSocket support in browsers is ubiquitous.
2228
Please check [https://caniuse.com/#feat=websockets](https://caniuse.com/#feat=websockets).
23-
Depending on your user base you can skip this page.
29+
Depending on your user base, you can skip this page.
2430

25-
You can use [SockJS client]
26-
to support browsers that do not natively support WebSockets.
31+
You can use [SockJS client] to support browsers that do not support WebSockets natively.
2732

2833
You would need to consider the following:
2934

3035
- URL protocol conventions are different for WebSockets (`ws:`/`wss:`) and SockJS (`http:` or `https:`).
31-
- Internal handshake sequences are different - so, some brokers will use different end points for
36+
- Internal handshake sequences are different so, some brokers will use different end points for
3237
both protocols.
33-
- Neither of these allow custom headers to be set during the HTTP handshake.
38+
- Neither of these allows custom headers to be set during the HTTP handshake.
3439
- SockJS internally supports different transport mechanisms. You might face specific limitations
3540
depending on actual transport in use.
3641
- Auto reconnect is not quite reliable with SockJS.
@@ -44,7 +49,7 @@ It is advised to use WebSockets by default and then fall back to SockJS if the b
4449

4550
### In Node.js environments
4651

47-
Please install latest [SockJS client]:
52+
Please install the latest[SockJS client]:
4853

4954
```bash
5055
$ npm install sockjs-client --save
@@ -145,7 +150,7 @@ See: [ng2-stompjs/issues/70].
145150
When you are using SockJS in an Angular6 project you might get **"global is not defined"**.
146151

147152
The underlying issue can only be fixed by SockJS or Angular teams.
148-
Try any of the following as a possible work around (from [ng2-stompjs/issues/70]):
153+
Try any of the following workarounds (from [ng2-stompjs/issues/70]):
149154

150155
- In your index.html file, in the header add the following:
151156

0 commit comments

Comments
 (0)