Skip to content

Commit 6594d60

Browse files
author
Deepak Kumar
committed
Refined FAQ documentation: improved clarity, updated links, aligned terminology, consolidated examples, and emphasized modern usage patterns across multiple topics.
1 parent c685c4f commit 6594d60

20 files changed

+126
-129
lines changed

_faqs/alternatives-are-there-any-missing-features-from-original-jeff-mesnil-stompjs.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ group: Jeff Mesnil's stompjs
44
priority: ZAE
55
---
66

7-
Jeff Mesnil's stompjs supports STOMP over TCP when used in the NodeJS environment.
8-
Other than this, there is no known missing functionality.
9-
If you intend to use this feature, please raise an issue.
7+
The original `stompjs` offered STOMP over TCP in Node.js.
8+
`@stomp/stompjs` focuses on STOMP over WebSocket (WebStomp), which is supported by most brokers.
109

11-
Jeff Mesnil's stompjs is not fully compliant to STOMP protocol.
12-
The `@stomp/stompjs` strictly adheres the protocol.
13-
This might, in some cases, give behavioral differences.
14-
If you are facing any such issues, please raise an issue.
10+
`@stomp/stompjs` adheres more strictly to the STOMP specification than the original library,
11+
so behavior may differ in edge cases. If you hit issues, please raise an issue.
12+
13+
If you specifically need STOMP over TCP in Node.js, consider using the TCP Wrapper:
14+
https://github.com/stomp-js/tcp-wrapper

_faqs/alternatives-how-do-i-migrate-from-jeff-mesnil-s-stompjs.md

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,7 @@ group: Jeff Mesnil's stompjs
44
priority: ZAC
55
---
66

7-
Please see [upgrading stompjs](/guide/stompjs/upgrading-stompjs.html)
8-
guide.
7+
See the upgrade guide: {% link _posts/2018-09-08-upgrading-stompjs.md %}
98

10-
The v4 of this library is backwards compatible with the original stompjs.
11-
In all likelihoods your working code would work under compatibility mode of
12-
v5.
13-
14-
To use newer features like automatic reconnection, compliance with STOMP
15-
standards, and binary payloads, you would need to upgrade to newer syntax.
9+
v4 provides compatibility with the original `stompjs`.
10+
For newer features (auto-reconnect, full STOMP compliance, binary payloads), migrate to the v5+ API.

_faqs/alternatives-how-is-it-related-to-stompjs-from-jeff-mesnil.md

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,9 @@ priority: ZAA
55
---
66

77
[stompjs](https://www.npmjs.com/package/stompjs)
8-
from [Jeff Mesnil](http://jmesnil.net/) has been one of the initial
9-
STOMP implementations for JavaScript.
10-
However, the original author has no longer been maintaining it since 2016.
11-
`@stomp/stompjs` started as a maintained fork.
8+
from [Jeff Mesnil](http://jmesnil.net/) was one of the first STOMP implementations for JavaScript.
9+
It has not been maintained since 2016. `@stomp/stompjs` started as a maintained fork.
1210

13-
`@stomp/stompjs` v4 is an enhanced version of
14-
[stompjs](https://www.npmjs.com/package/stompjs)
15-
from [Jeff Mesnil](http://jmesnil.net/).
16-
17-
Version 5 of `@stomp/stompjs` has been bottom up rewritten in TypeScript.
18-
This version supports the older API in compatibility mode.
11+
`@stomp/stompjs` v4 enhanced the original API and remained compatible.
12+
From v5 onward, `@stomp/stompjs` was rewritten in TypeScript and offers a modern API while
13+
retaining a compatibility mode.

_faqs/authentication-can-i-use-token-based-authentication-with-these-libraries.md

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4,25 +4,13 @@ group: Authentication
44
priority: GAA
55
---
66

7-
Even though [WebSocket](https://developer.mozilla.org/en-US/docs/Web/API/WebSocket)
8-
is somewhat similar to HTTP(S), it differs in one very important aspect — it
9-
does not allow control of headers.
7+
While WebSocket is initiated via HTTP(S), custom headers cannot be set during the handshake.
108

11-
This poses a limitation on using token-based authentication schemes using HTTP headers.
12-
13-
Conventional brokers do not expect any authentication information as part of
14-
HTTP headers or HTTP connection parameters.
15-
These instead rely on STOMP protocol's
16-
[CONNECT Frame](https://stomp.github.io/stomp-specification-1.2.html#CONNECT_or_STOMP_Frame).
17-
This frame can have headers as key/value pairs.
18-
You can control these by setting
19-
[connectHeaders](https://stomp-js.github.io/api-docs/latest/classes/Client.html#connectHeaders)
20-
configuration option.
21-
You can pass any pair of strings as keys and values.
22-
23-
So, typically, for token-based authentication you will pass the token as part of
9+
STOMP brokers typically expect authentication in the STOMP
10+
[CONNECT frame](https://stomp.github.io/stomp-specification-1.2.html#CONNECT_or_STOMP_Frame)
11+
via headers. You can supply arbitrary key/value pairs using
2412
[connectHeaders](https://stomp-js.github.io/api-docs/latest/classes/Client.html#connectHeaders).
25-
Check your broker documentation for details.
2613

27-
If you are using Spring, please check
28-
[https://docs.spring.io/spring/docs/current/spring-framework-reference/web.html#websocket-stomp-authentication-token-based](https://docs.spring.io/spring/docs/current/spring-framework-reference/web.html#websocket-stomp-authentication-token-based)
14+
For token-based authentication, include your token in `connectHeaders` as required by your broker.
15+
If using Spring, see:
16+
https://docs.spring.io/spring-framework/reference/web/websocket/stomp/authentication.html#websocket-stomp-authentication-token-based

_faqs/authentication-my-authentication-tokens-expire-where-should-i-write-code-to-acquire-fresh-tokens.md

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,9 @@ group: Authentication
44
priority: GAC
55
---
66

7-
The suggested place to acquire fresh tokens is
8-
[beforeConnect](https://stomp-js.github.io/api-docs/latest/classes/Client.html#beforeConnect)
9-
callback.
10-
You can update the
7+
Use the [beforeConnect](https://stomp-js.github.io/api-docs/latest/classes/Client.html#beforeConnect)
8+
callback to fetch a fresh token and update
119
[connectHeaders](https://stomp-js.github.io/api-docs/latest/classes/Client.html#connectHeaders)
12-
after you have acquired a fresh token.
10+
just before each (re)connect.
1311

14-
If you need to fetch a token using an async request (say using an XHR),
15-
you can set an async function as the callback.
12+
If you need async fetching (e.g., HTTP call), make `beforeConnect` an async function.

_faqs/general-bundlers.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,5 @@ priority: ADK
66

77
Yes.
88

9-
These libraries include ES6 modules in the distribution,
10-
so, any environment that uses `import` will be able to find modules
11-
without any additional configuration.
9+
The packages ship ES modules compatible with modern bundlers (e.g., Vite, Rollup, Webpack, Parcel).
10+
Tree-shaking works well when you import the specific symbols you need.

_faqs/general-can-these-libraries-be-used-with-es6-or-typescript.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,8 @@ priority: ACC
66

77
Yes.
88

9-
From 2023, these libraries are distributed as Javascript modules as default.
10-
These can be used with `import`.
9+
These libraries are distributed as JavaScript ES Modules by default and can be imported with `import`.
1110

12-
All these libraries have been developed in TypeScript and type definition
13-
files are included in releases.
11+
All libraries are developed in TypeScript and include type definitions.
1412

15-
In addition, a UMD bundle is included to be used as a html script tag.
13+
A UMD bundle is also provided for direct use via a `<script>` tag in browsers.

_faqs/general-how-do-i-enable-logging.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@ group: General
44
priority: AGA
55
---
66

7-
Please see [enabling debug log](/guide/stompjs/using-stompjs-v5.html#debug).
7+
See the Debug section in the guide: {% link _posts/2018-06-29-using-stompjs-v5.md %}#debug
88

9-
The console debug output may have NULL characters, which will prevent it from copying and pasting
10-
into a GitHub issue.
11-
In such cases, save it as a text file and attach with the issue.
9+
The console debug output may contain NULL characters, which can break copy/paste into an issue.
10+
If that happens, save the output to a text file and attach it to the issue.

_faqs/general-i-am-using-angular-which-of-stompjs-rx-stomp-or-ng2-stompjs-should-i-use.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,18 @@ There is a tutorial for using `rx-stomp` with Angular. Please see [guides](/#get
1010

1111
Having said all of these, you can use any of the variants.
1212
Developers have reported successfully using `stompjs` directly with Angular.
13+
14+
Angular makes heavy use of [RxJS](https://github.com/ReactiveX/RxJS), so `rx-stomp` is the recommended choice for Angular apps.
15+
16+
Why `rx-stomp`:
17+
- Native RxJS APIs (Observables) for messages, connection state, and lifecycles.
18+
- Subscriptions auto-reestablish on reconnects without manual bookkeeping.
19+
- Works well with Angular patterns (services, dependency injection, async pipes).
20+
21+
When to use `stompjs`:
22+
- You want the lightest possible dependency set and prefer imperative APIs.
23+
- You are not using RxJS in your app.
24+
25+
Helpful links:
26+
- Angular sample using `@stomp/rx-stomp`: https://github.com/stomp-js/rx-stomp-angular
27+
- Migrating from `ng2-stompjs` to `rx-stomp`: {% link _posts/2022-03-03-ng2-stompjs-to-rx-stomp.md %}

_faqs/general-polyfills-classes.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,8 @@ group: General
44
priority: AKA
55
---
66

7-
Please see [StompJs v5: Polyfills](/guide/stompjs/rx-stomp/polyfills-for-stompjs.html)
7+
Please see the Polyfills guide: {% link _posts/2018-06-28-polyfills-for-stompjs.md %}
8+
9+
- Node.js: provide a WebSocket implementation and ensure TextEncoder/TextDecoder exist.
10+
- React Native: add TextEncoder/TextDecoder; WebSocket is provided by RN.
11+
- Browsers: typically no polyfills are required.

0 commit comments

Comments
 (0)