Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 849524c

Browse files
committedMar 23, 2025·
Add references to React tutorial, Add new features from 7.1.0
1 parent 6b5aac1 commit 849524c

File tree

3 files changed

+141
-55
lines changed

3 files changed

+141
-55
lines changed
 

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

Lines changed: 112 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,27 @@
11
---
22
layout: single
3-
title: 'Using StompJs v5+'
4-
date: 2018-06-29 07:59:22 +0530
3+
title: 'Using StompJs'
4+
date: 2025-03-22 07:59:22 +0530
55
categories: guide stompjs
66
toc: true
77
redirect_from:
88
- /guide/stompjs/2018/06/28/using-stompjs-v5.html
99
- /guide/stompjs/2018/06/29/using-stompjs-v5.html
1010
- /guide/stompjs/2018/06/30/using-stompjs-v5.html
11+
- /guide/stompjs/using-stompjs-v5.html
1112
---
1213

1314
You can find samples at [https://github.com/stomp-js/samples/](https://github.com/stomp-js/samples/).
1415

1516
## The STOMP Broker
1617

17-
Ensure that your STOMP broker supports STOMP over WebSockets. While some messaging brokers support it out of the box, a few may need additional configuration or activating plugins.
18+
Ensure that your STOMP broker supports STOMP over WebSockets. While some messaging brokers support it out of the box, a
19+
few may need additional configuration or activating plugins.
1820

1921
## Include stompjs
2022

21-
This npm distribution has a UMD package and ES6 modules. The web browsers will use the UMD via a script tag, and Node's `require` and ES `import` will use the appropriate versions.
23+
This npm distribution has a UMD package and ES6 modules. The web browsers will use the UMD via a script tag, and Node's
24+
`require` and ES `import` will use the appropriate versions.
2225

2326
### Polyfills
2427

@@ -28,8 +31,9 @@ _Important: For NodeJS and React Native, please check [Polyfills]._
2831

2932
- Download and include directly from the `bundles/` folder.
3033
- Alternatively, use from CDN
31-
- Minified [https://cdn.jsdelivr.net/npm/@stomp/stompjs@5.0.0/bundles/stomp.umd.min.js](https://cdn.jsdelivr.net/npm/@stomp/stompjs@5.0.0/bundles/stomp.umd.min.js)
32-
- [https://cdn.jsdelivr.net/npm/@stomp/stompjs@5.0.0/bundles/stomp.umd.js](https://cdn.jsdelivr.net/npm/@stomp/stompjs@5.0.0/bundles/stomp.umd.js)
34+
-
35+
Minified [https://cdn.jsdelivr.net/npm/@stomp/stompjs@5.0.0/bundles/stomp.umd.min.js](https://cdn.jsdelivr.net/npm/@stomp/stompjs@5.0.0/bundles/stomp.umd.min.js)
36+
- [https://cdn.jsdelivr.net/npm/@stomp/stompjs@5.0.0/bundles/stomp.umd.js](https://cdn.jsdelivr.net/npm/@stomp/stompjs@5.0.0/bundles/stomp.umd.js)
3337
- `StompJs` object will now be available. Read along to learn how to use it.
3438

3539
### In NodeJS, TypeScript or ES6
@@ -39,7 +43,7 @@ These libraries have been developed using typescript, and the typings are includ
3943
You can import classes like the following:
4044

4145
```javascript
42-
import { Client, Message } from '@stomp/stompjs';
46+
import {Client, Message} from '@stomp/stompjs';
4347
```
4448

4549
You can use these classes without prefixing with `StompJs.`.
@@ -105,10 +109,11 @@ client.deactivate();
105109

106110
## Send messages
107111

108-
When the client is connected to the server, it can send STOMP messages using the [Client#publish](/api-docs/latest/classes/Client.html#publish) method.
112+
When the client is connected to the server, it can send STOMP messages using
113+
the [Client#publish](/api-docs/latest/classes/Client.html#publish) method.
109114

110115
```javascript
111-
client.publish({ destination: '/topic/general', body: 'Hello world' });
116+
client.publish({destination: '/topic/general', body: 'Hello world'});
112117

113118
// There is an option to skip content length header
114119
client.publish({
@@ -121,7 +126,7 @@ client.publish({
121126
client.publish({
122127
destination: '/topic/general',
123128
body: 'Hello world',
124-
headers: { priority: '9' },
129+
headers: {priority: '9'},
125130
});
126131
```
127132

@@ -135,16 +140,18 @@ const binaryData = generateBinaryData(); // This need to be of type Uint8Array
135140
client.publish({
136141
destination: '/topic/special',
137142
binaryBody: binaryData,
138-
headers: { 'content-type': 'application/octet-stream' },
143+
headers: {'content-type': 'application/octet-stream'},
139144
});
140145
```
141146

142147
## Subscribe and receive messages
143148

144149
The STOMP client must first subscribe to a destination to receive messages.
145150

146-
To subscribe to a destination, you can use the [Client#subscribe](/api-docs/latest/classes/Client.html#subscribe) method. The method takes two mandatory arguments: `destination`, a String corresponding to the
147-
destination and `callback`, a function with one message argument and an optional argument `headers`, a JavaScript object for additional headers.
151+
To subscribe to a destination, you can use the [Client#subscribe](/api-docs/latest/classes/Client.html#subscribe)
152+
method. The method takes two mandatory arguments: `destination`, a String corresponding to the
153+
destination and `callback`, a function with one message argument and an optional argument `headers`, a JavaScript object
154+
for additional headers.
148155

149156
```javascript
150157
const subscription = client.subscribe('/queue/test', callback);
@@ -154,7 +161,8 @@ The `subscribe` method returns an object with one attribute, `id`,
154161
that correspond to the client subscription ID and one method `unsubscribe`
155162
that can be used later on to unsubscribe the client from this destination.
156163

157-
Every time the broker sends a message to the client, the client will, in turn, invoke the callback with a [Message](/api-docs/latest/interfaces/IMessage.html) object.
164+
Every time the broker sends a message to the client, the client will, in turn, invoke the callback with
165+
a [Message](/api-docs/latest/interfaces/IMessage.html) object.
158166

159167
```javascript
160168
callback = function (message) {
@@ -167,10 +175,11 @@ callback = function (message) {
167175
};
168176
```
169177

170-
The `subscribe` method takes an optional headers argument to specify additional `headers` when subscribing to a destination:
178+
The `subscribe` method takes an optional headers argument to specify additional `headers` when subscribing to a
179+
destination:
171180

172181
```javascript
173-
const headers = { ack: 'client' };
182+
const headers = {ack: 'client'};
174183
client.subscribe('/queue/test', message_callback, headers);
175184
```
176185

@@ -193,24 +202,29 @@ subscription.unsubscribe();
193202
### Prepare your broker
194203

195204
Not every broker will support binary messages out of the box.
196-
For example, RabbitMQ (see: https://www.rabbitmq.com/web-stomp.html) will need the following to be added to the server configuration:
205+
For example, RabbitMQ (see: https://www.rabbitmq.com/web-stomp.html) will need the following to be added to the server
206+
configuration:
197207

198208
```
199209
web_stomp.ws_frame = binary
200210
```
201211

202212
### Publishing binary messages
203213

204-
Use parameter `binaryBody` of [Client#publish](/api-docs/latest/classes/Client.html#publish) to send binary data of a type [Uint8Array].
214+
Use parameter `binaryBody` of [Client#publish](/api-docs/latest/classes/Client.html#publish) to send binary data of a
215+
type [Uint8Array].
205216

206217
See [Send messages](#send-messages) for an example.
207218

208219
### Receiving binary messages
209220

210221
The library does not guess whether the incoming datum is text/binary.
211-
To access the message body as a string, please use [Message#body](/api-docs/latest/interfaces/IFrame.html#body) and to access it as binary, please use [Message#binaryBody](/api-docs/latest/interfaces/IFrame.html#binaryBody).
222+
To access the message body as a string, please use [Message#body](/api-docs/latest/interfaces/IFrame.html#body) and to
223+
access it as binary, please use [Message#binaryBody](/api-docs/latest/interfaces/IFrame.html#binaryBody).
212224

213-
There is no generally accepted convention in STOMP (actually messaging in general) to indicate binary messages. Therefore, the message senders and receivers must agree on the required convention. For example, you may choose to set a `content-type` header to indicate a binary message.
225+
There is no generally accepted convention in STOMP (actually messaging in general) to indicate binary messages.
226+
Therefore, the message senders and receivers must agree on the required convention. For example, you may choose to set a
227+
`content-type` header to indicate a binary message.
214228

215229
```javascript
216230
// within message callback
@@ -225,10 +239,11 @@ if (message.headers['content-type'] === 'application/octet-stream') {
225239

226240
## JSON support
227241

228-
The body of a STOMP message must be a String or a [Uint8Array]. If you want to send and receive [JSON](http://json.org/) objects, you can use `JSON.stringify()` and`JSON.parse()` to transform the JSON object to a String and vice versa.
242+
The body of a STOMP message must be a String or a [Uint8Array]. If you want to send and receive [JSON](http://json.org/)
243+
objects, you can use `JSON.stringify()` and`JSON.parse()` to transform the JSON object to a String and vice versa.
229244

230245
```javascript
231-
const quote = { symbol: 'AAPL', value: 195.46 };
246+
const quote = {symbol: 'AAPL', value: 195.46};
232247
client.publish({
233248
destination: '/topic/stocks',
234249
body: JSON.stringify(quote),
@@ -244,9 +259,11 @@ client.subscribe('/topic/stocks', function (message) {
244259

245260
By default, the server will automatically acknowledge STOMP messages before the message is delivered to the client.
246261

247-
Instead, the client can choose to handle message acknowledgment by subscribing to a destination with the `ack` header set to `client` or `client-individual`.
262+
Instead, the client can choose to handle message acknowledgment by subscribing to a destination with the `ack` header
263+
set to `client` or `client-individual`.
248264

249-
In that case, the client must use the [Message#ack](/api-docs/latest/interfaces/IMessage.html#ack) method to inform the broker that it has processed the message.
265+
In that case, the client must use the [Message#ack](/api-docs/latest/interfaces/IMessage.html#ack) method to inform the
266+
broker that it has processed the message.
250267

251268
```javascript
252269
const subscription = client.subscribe(
@@ -257,47 +274,54 @@ const subscription = client.subscribe(
257274
// and acknowledge it
258275
message.ack();
259276
},
260-
{ ack: 'client' }
277+
{ack: 'client'}
261278
);
262279
```
263280

264-
The [Message#ack](/api-docs/latest/interfaces/IMessage.html#ack) method accepts `headers` argument for additional headers. For example, to acknowledge a message as part of a transaction and request a receipt:
281+
The [Message#ack](/api-docs/latest/interfaces/IMessage.html#ack) method accepts `headers` argument for additional
282+
headers. For example, to acknowledge a message as part of a transaction and request a receipt:
265283

266284
```javascript
267285
const tx = client.begin();
268-
message.ack({ transaction: tx.id, receipt: 'my-receipt' });
286+
message.ack({transaction: tx.id, receipt: 'my-receipt'});
269287
tx.commit();
270288
```
271289

272-
The client should [Message#nack](/api-docs/latest/interfaces/IMessage.html#nack) to inform STOMP 1.1 or higher brokers that the client did not consume the message. It takes the same arguments as the [Message#ack](/api-docs/latest/interfaces/IMessage.html#ack) method.
290+
The client should [Message#nack](/api-docs/latest/interfaces/IMessage.html#nack) to inform STOMP 1.1 or higher brokers
291+
that the client did not consume the message. It takes the same arguments as
292+
the [Message#ack](/api-docs/latest/interfaces/IMessage.html#ack) method.
273293

274294
## Transactions
275295

276296
Messages can be sent and acknowledged _in a transaction_.
277297

278-
The client starts a transaction using the [Client#begin](/api-docs/latest/classes/Client.html#begin) method, which takes an optional `transaction_id`.
298+
The client starts a transaction using the [Client#begin](/api-docs/latest/classes/Client.html#begin) method, which takes
299+
an optional `transaction_id`.
279300

280301
This method returns an object with an `id` attribute corresponding to the transaction ID and two methods:
281302

282303
- [Client#commit](/api-docs/latest/classes/Client.html#commit) to commit the transaction, and,
283304
- [Client#abort](/api-docs/latest/classes/Client.html#abort) to abort the transaction.
284305

285-
The client can then send and acknowledge messages in the transaction by specifying a `transaction` indetified by the transaction `id`.
306+
The client can then send and acknowledge messages in the transaction by specifying a `transaction` indetified by the
307+
transaction `id`.
286308

287309
```javascript
288310
// start the transaction
289311
const tx = client.begin();
290312
// send the message in a transaction
291313
client.publish({
292314
destination: '/queue/test',
293-
headers: { transaction: tx.id },
315+
headers: {transaction: tx.id},
294316
body: 'message in a transaction',
295317
});
296318
// commit the transaction to effectively send the message
297319
tx.commit();
298320
```
299321

300-
_If you forget to add the `transaction` header when calling [Client#publish](/api-docs/latest/classes/Client.html#publish), the message will not be part of the transaction, and it will be sent directly without waiting for the completion of the transaction._
322+
_If you forget to add the `transaction` header when
323+
calling [Client#publish](/api-docs/latest/classes/Client.html#publish), the message will not be part of the transaction,
324+
and it will be sent directly without waiting for the completion of the transaction._
301325

302326
```javascript
303327
// start the transaction
@@ -312,7 +336,10 @@ tx.abort(); // Too late! the message has been sent
312336

313337
## Heart-beating
314338

315-
For a connection with STOMP protocol 1.1 or higher, heart-beating is enabled by default. Options [Client#heartbeatIncoming](/api-docs/latest/classes/Client.html#heartbeatIncoming) and [Client#heartbeatOutgoing](/api-docs/latest/classes/Client.html#heartbeatOutgoing) can be used to control heart-beating (default value for both is 10,000ms). The client can disable heart beating by setting these to 0.
339+
For a connection with STOMP protocol 1.1 or higher, heart-beating is enabled by default.
340+
Options [Client#heartbeatIncoming](/api-docs/latest/classes/Client.html#heartbeatIncoming)
341+
and [Client#heartbeatOutgoing](/api-docs/latest/classes/Client.html#heartbeatOutgoing) can be used to control
342+
heart-beating (default value for both is 10,000ms). The client can disable heart beating by setting these to 0.
316343

317344
```javascript
318345
client.heartbeatOutgoing = 20000; // client will send heartbeats every 20000ms
@@ -322,7 +349,9 @@ client.heartbeatIncoming = 0; // client does not want to receive heartbeats
322349

323350
## Auto Reconnect
324351

325-
The `client` supports automatic reconnecting in case of a connection failure. It is controlled by a option [Client#reconnectDelay](/api-docs/latest/classes/Client.html#reconnectDelay). The default value is 5000ms, which indicates that an attempt to connect will be made 5000ms after a connection drop.
352+
The `client` supports automatic reconnecting in case of a connection failure. It is controlled by a
353+
option [Client#reconnectDelay](/api-docs/latest/classes/Client.html#reconnectDelay). The default value is 5000ms, which
354+
indicates that an attempt to connect will be made 5000ms after a connection drop.
326355

327356
```javascript
328357
// Add the following if you need automatic reconnect (delay is in milliseconds)
@@ -331,50 +360,84 @@ client.reconnectDelay = 300;
331360

332361
You can set the `reconnectDelay` to quite a small value.
333362

363+
**Reconnect with Exponential Backoff**
364+
365+
```javascript
366+
client.configure({
367+
reconnectTimeMode: StompJs.ReconnectionTimeMode.EXPONENTIAL,
368+
reconnectDelay: 200, // It will wait 200, 400, 800 ms...
369+
maxReconnectDelay: 10000, // Optional, when provided, it will not wait more that these ms
370+
})
371+
```
372+
334373
## Debug
335374

336375
On a busy system, the volume of logs can be overwhelming. Therefore, by default, the debug messages are ignored.
337376

338-
[Client#debug](/api-docs/latest/classes/Client.html#debug) property can be set to a function (which will receive a `String` argument) to enable debug statements:
377+
[Client#debug](/api-docs/latest/classes/Client.html#debug) property can be set to a function (which will receive a
378+
`String` argument) to enable debug statements:
339379

340380
```javascript
341381
client.debug = function (str) {
342382
console.log(str);
343383
};
344384
```
345385

346-
Usually, headers of the incoming and outgoing frames are logged. Set [Client#logRawCommunication](/api-docs/latest/classes/Client.html#logRawCommunication) to log entire frames.
386+
Usually, headers of the incoming and outgoing frames are logged.
387+
Set [Client#logRawCommunication](/api-docs/latest/classes/Client.html#logRawCommunication) to log entire frames.
347388

348389
## Callbacks
349390

350391
### Lifecycle callbacks
351392

352-
- [Client#beforeConnect](/api-docs/latest/classes/Client.html#beforeConnect) - invoked each time before connection to STOMP broker is attempted. You can modify connection parameters and other callbacks. On v6+ you can set an async function for this callback.
353-
- [Client#onConnect](/api-docs/latest/classes/Client.html#onConnect) - invoked for each time STOMP broker connects and STOMP handshake is complete.
354-
- [Client#onDisconnect](/api-docs/latest/classes/Client.html#onDisconnect) - invoked after each graceful disconnection. If the connection breaks because of an error or network failure, it will not be called.
393+
- [Client#beforeConnect](/api-docs/latest/classes/Client.html#beforeConnect) - invoked each time before connection to
394+
STOMP broker is attempted. You can modify connection parameters and other callbacks. On v6+ you can set an async
395+
function for this callback.
396+
- [Client#onConnect](/api-docs/latest/classes/Client.html#onConnect) - invoked for each time STOMP broker connects and
397+
STOMP handshake is complete.
398+
- [Client#onDisconnect](/api-docs/latest/classes/Client.html#onDisconnect) - invoked after each graceful disconnection.
399+
If the connection breaks because of an error or network failure, it will not be called.
355400
- [Client#onStompError](/api-docs/latest/classes/Client.html#onStompError) - invoked when the broker reports an Error.
356-
- [Client#onWebSocketClose](/api-docs/latest/classes/Client.html#onWebSocketClose) - when the WebSocket closes. It is the most reliable way of knowing that the connection has terminated.
401+
- [Client#onWebSocketClose](/api-docs/latest/classes/Client.html#onWebSocketClose) - when the WebSocket closes. It is
402+
the most reliable way of knowing that the connection has terminated.
357403

358404
### Frame callbacks
359405

360-
- [Client#onUnhandledMessage](/api-docs/latest/classes/Client.html#onUnhandledMessage) - typically brokers will send messages corresponding to subscriptions. However, brokers may support concepts beyond the standard definition of STOMP - for example, RabbitMQ supports concepts of temporary queues. This callback will be invoked if any message is received that is not linked to a subscription.
361-
- [Client#onUnhandledReceipt](/api-docs/latest/classes/Client.html#onUnhandledReceipt) - you should prefer [Client#watchForReceipt](/api-docs/latest/classes/Client.html#watchForReceipt). If there is any incoming receipt for which there is no active watcher, this callback will be invoked.
362-
- [Client#onUnhandledFrame](/api-docs/latest/classes/Client.html#onUnhandledFrame) - it will be invoked if broker sends a non standard STOMP Frame.
406+
- [Client#onUnhandledMessage](/api-docs/latest/classes/Client.html#onUnhandledMessage) - typically brokers will send
407+
messages corresponding to subscriptions. However, brokers may support concepts beyond the standard definition of
408+
STOMP - for example, RabbitMQ supports concepts of temporary queues. This callback will be invoked if any message is
409+
received that is not linked to a subscription.
410+
- [Client#onUnhandledReceipt](/api-docs/latest/classes/Client.html#onUnhandledReceipt) - you should
411+
prefer [Client#watchForReceipt](/api-docs/latest/classes/Client.html#watchForReceipt). If there is any incoming
412+
receipt for which there is no active watcher, this callback will be invoked.
413+
- [Client#onUnhandledFrame](/api-docs/latest/classes/Client.html#onUnhandledFrame) - it will be invoked if broker sends
414+
a non standard STOMP Frame.
363415

364416
## Advanced notes
365417

366418
Version 5+ of this library has taken significant variation from the previous syntax.
367419

368-
It is possible to alter configuration options and callbacks. New values will take effect as soon as possible. For example:
420+
It is possible to alter configuration options and callbacks. New values will take effect as soon as possible. For
421+
example:
369422

370-
- Altered values of [Client#onUnhandledMessage](/api-docs/latest/classes/Client.html#onUnhandledMessage) or [Client#onDisconnect](/api-docs/latest/classes/Client.html#onDisconnect) will be effective immediately.
371-
- New values of [Client#heartbeatIncoming](/api-docs/latest/classes/Client.html#heartbeatIncoming) and [Client#heartbeatOutgoing](/api-docs/latest/classes/Client.html#heartbeatOutgoing) will be used next time STOMP connects.
423+
- Altered values of [Client#onUnhandledMessage](/api-docs/latest/classes/Client.html#onUnhandledMessage)
424+
or [Client#onDisconnect](/api-docs/latest/classes/Client.html#onDisconnect) will be effective immediately.
425+
- New values of [Client#heartbeatIncoming](/api-docs/latest/classes/Client.html#heartbeatIncoming)
426+
and [Client#heartbeatOutgoing](/api-docs/latest/classes/Client.html#heartbeatOutgoing) will be used next time STOMP
427+
connects.
372428

373-
The callback sequences are arranged in a way that most expected operations should work. For example, it is possible to call [Client#deactivate](/api-docs/latest/classes/Client.html#deactivate) within [Client#onStompError](/api-docs/latest/classes/Client.html#onStompError) or [Client#onWebSocketClose](/api-docs/latest/classes/Client.html#onWebSocketClose).
429+
The callback sequences are arranged in a way that most expected operations should work. For example, it is possible to
430+
call [Client#deactivate](/api-docs/latest/classes/Client.html#deactivate)
431+
within [Client#onStompError](/api-docs/latest/classes/Client.html#onStompError)
432+
or [Client#onWebSocketClose](/api-docs/latest/classes/Client.html#onWebSocketClose).
374433

375-
The above also allows adjusting [Client#reconnectDelay](/api-docs/latest/classes/Client.html#reconnectDelay) in [Client#onWebSocketClose](/api-docs/latest/classes/Client.html#onWebSocketClose). You can implement exponential back-off using a series of such adjustments.
434+
The above also allows adjusting [Client#reconnectDelay](/api-docs/latest/classes/Client.html#reconnectDelay)
435+
in [Client#onWebSocketClose](/api-docs/latest/classes/Client.html#onWebSocketClose). You can implement exponential
436+
back-off using a series of such adjustments.
376437

377-
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.
438+
Even [Client#brokerURL](/api-docs/latest/classes/Client.html#brokerURL)
439+
or [Client#connectHeaders](/api-docs/latest/classes/Client.html#connectHeaders) can be altered which would get used in a
440+
subsequent reconnect.
378441

379442
[Polyfills]: {% link _posts/2018-06-28-polyfills-for-stompjs.md %}
380443
[Uint8Array]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array

‎_posts/2019-06-10-react-native-additional-notes.md‎

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
layout: single
33
title: 'React Native - Additional notes'
4-
date: 2024-04-26 10:01:01 +0530
4+
date: 2025-03-22 10:01:01 +0530
55
categories: workaround stompjs rx-stomp
66
toc: true
77
redirect_from:
@@ -12,12 +12,25 @@ redirect_from:
1212
- /workaround/stompjs/rx-stomp/ng2-stompjs/react-native-additional-notes.html
1313
---
1414

15-
# Polyfills
15+
The largest number of tickets raised for these projects is related to using these libraries with React Native.
16+
There are some platform issues in React Native that cause these libraries to fail.
17+
Unfortunately, the React Native team is not inclined to resolve these issues.
18+
Please follow the advice on this page to effectively use these libraries with React Native.
19+
20+
## Prefer [rx-stomp]
21+
22+
This advice is not specific to React Native, but in general, to Single Page Applications.
23+
Your code is going to be far less convoluted and will handle edge cases much better.
24+
Managing the Client objest and state can be tricky with React hooks.
25+
Please see
26+
[How to Use RxStomp with React](https://www.freecodecamp.org/news/build-chat-app-with-stomp-and-react/) and [Sample](https://gitlab.com/harsh183/rxstomp-react-tutorial).
27+
28+
## Polyfills
1629

1730
Before you proceed, ensure you have [polyfills for
1831
TextEncoder/TextDecoder]({% link _posts/2018-06-28-polyfills-for-stompjs.md %}).
1932

20-
# Insecure connection issue in Android
33+
## Insecure connection issue in Android
2134

2235
Recent versions of Android SDK do not allow insecure (not HTTPS) HTTP connections.
2336
This is likely to show up in production builds only.
@@ -27,7 +40,7 @@ To bypass the checks, please follow suggestions at
2740
[https://github.com/stomp-js/stompjs/issues/149#issuecomment-633734719](https://github.com/stomp-js/stompjs/issues/149#issuecomment-633734719)
2841
and [https://blog.usejournal.com/6-daily-issues-in-android-cleartext-traffic-error-52ab31dd86c2](https://blog.usejournal.com/6-daily-issues-in-android-cleartext-traffic-error-52ab31dd86c2).
2942

30-
# Null Chopping
43+
## Null Chopping
3144

3245
Some versions of React Native (including the current production
3346
version as on April 26, 2024) have an underlying issue that prevents these libraries
@@ -85,3 +98,8 @@ If your broker supports forcing binary frames, you may try this approach.
8598

8699
The approach is completely safe — it will not cause any data loss
87100
or incorrect protocol behavior.
101+
102+
103+
[rxjs]: https://github.com/ReactiveX/RxJS
104+
[stompjs]: https://github.com/stomp-js/stompjs
105+
[rx-stomp]: https://github.com/stomp-js/rx-stomp

‎index.md‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
---
22
layout: single
3-
date: 2020-10-19 19:42:22 +0530
3+
date: 2025-03-22 19:42:22 +0530
44
title: 'StompJs Family'
55
author_profile: true
66
---
77

88
These libraries provide [STOMP] over [Websocket] connectivity for web browsers or other Javascript-based environments.
99

10-
[stompjs] is the core Javascript library. [rx-stomp] is a wrapper that exposes functionality as [RxJS] primitives.
10+
[stompjs] is the core JavaScript library.
11+
[rx-stomp] is a wrapper that exposes functionality as [RxJS] primitives.
1112
If you are already using [RxJS] in your project or are familiar with it, check out [rx-stomp].
1213

1314
## Getting started
@@ -18,11 +19,15 @@ Please try the following guides:
1819
- [Using rx-stomp with Angular] — originally written for Angular13,
1920
should work with Angular 7+.
2021
- Guide to [Connection status in ng2-stompjs].
22+
- Guide to [How to Use RxStomp with React](https://www.freecodecamp.org/news/build-chat-app-with-stomp-and-react/).
23+
24+
All these guides are written by the maintainers of these projects and follow best practices.
2125

2226
Samples:
2327

2428
- [Samples](https://github.com/stomp-js/samples/) for [stompjs] and [rx-stomp].
2529
- [Sample](https://github.com/stomp-js/rx-stomp-angular) for [rx-stomp] with Angular 7+.
30+
- [Sample](https://gitlab.com/harsh183/rxstomp-react-tutorial) for [rx-stomp] with React.
2631

2732
[API documentation](/api-docs/latest/) for NPM released versions.
2833

0 commit comments

Comments
 (0)
Please sign in to comment.