@stomp/stompjs 7.1.0 → 7.2.0
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/README.md +130 -106
- package/bundles/stomp.umd.js +452 -200
- package/bundles/stomp.umd.js.map +1 -1
- package/bundles/stomp.umd.min.js +1 -1
- package/esm6/client.d.ts +638 -273
- package/esm6/client.js +445 -198
- package/esm6/client.js.map +1 -1
- package/esm6/i-transaction.d.ts +0 -2
- package/esm6/stomp-config.d.ts +15 -2
- package/esm6/stomp-config.js.map +1 -1
- package/esm6/stomp-handler.d.ts +4 -1
- package/esm6/stomp-handler.js +7 -2
- package/esm6/stomp-handler.js.map +1 -1
- package/esm6/stomp-headers.d.ts +1 -1
- package/esm6/stomp-headers.js +1 -1
- package/esm6/ticker.js +2 -2
- package/esm6/ticker.js.map +1 -1
- package/esm6/types.d.ts +11 -2
- package/esm6/types.js.map +1 -1
- package/package.json +8 -8
- package/src/augment-websocket.ts +2 -2
- package/src/client.ts +664 -284
- package/src/compatibility/compat-client.ts +2 -2
- package/src/compatibility/stomp.ts +1 -1
- package/src/frame-impl.ts +6 -6
- package/src/i-transaction.ts +0 -2
- package/src/parser.ts +4 -4
- package/src/stomp-config.ts +17 -1
- package/src/stomp-handler.ts +30 -13
- package/src/stomp-headers.ts +1 -1
- package/src/ticker.ts +8 -6
- package/src/types.ts +14 -4
package/README.md
CHANGED
|
@@ -1,137 +1,153 @@
|
|
|
1
1
|
# STOMP.js
|
|
2
2
|
|
|
3
|
-
[](https://github.com/stomp-js/stompjs/actions/workflows/linux.yml)
|
|
4
|
-
[](https://github.com/stomp-js/stompjs/actions/workflows/osx.yml)
|
|
5
|
-
[](https://github.com/stomp-js/stompjs/actions/workflows/linux.yml)
|
|
4
|
+
[](https://github.com/stomp-js/stompjs/actions/workflows/osx.yml)
|
|
5
|
+
[](https://github.com/stomp-js/stompjs/actions/workflows/node-js.yml)
|
|
6
|
+
[](https://github.com/stomp-js/stompjs/actions/workflows/docs-refresh.yml)
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
**STOMP.js** is a fully-fledged STOMP over WebSocket library for **browsers** and **Node.js**, providing seamless integration with STOMP protocol-compliant messaging brokers.
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
## Table of Contents
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
- [Introduction](#introduction)
|
|
13
|
+
- [Features](#features)
|
|
14
|
+
- [Getting Started](#getting-started)
|
|
15
|
+
- [Browser](#browser)
|
|
16
|
+
- [Node.js](#nodejs)
|
|
17
|
+
- [Documentation](#documentation)
|
|
18
|
+
- [Upgrading](#upgrading)
|
|
19
|
+
- [Usage with RxJS](#usage-with-rxjs)
|
|
20
|
+
- [TypeScript Support](#typescript-support)
|
|
21
|
+
- [Changelog](#changelog)
|
|
22
|
+
- [Contributing](#contributing)
|
|
23
|
+
- [Authors](#authors)
|
|
24
|
+
- [License](#license)
|
|
13
25
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
26
|
+
## Introduction
|
|
27
|
+
|
|
28
|
+
This library enables clients to connect to STOMP brokers over WebSocket (or TCP). It fully implements the STOMP protocol specifications (v1.0, v1.1, and v1.2), making it compatible with any broker that supports STOMP or STOMP over WebSocket.
|
|
29
|
+
|
|
30
|
+
Popular brokers like RabbitMQ, ActiveMQ, and others provide support for STOMP and STOMP over WebSockets out-of-the-box.
|
|
18
31
|
|
|
19
32
|
## Features
|
|
20
33
|
|
|
21
|
-
- Simple API
|
|
22
|
-
- Support for
|
|
23
|
-
- Support for fallback options
|
|
24
|
-
-
|
|
25
|
-
- Option to
|
|
26
|
-
-
|
|
34
|
+
- Simple and intuitive API for interacting with the STOMP protocol
|
|
35
|
+
- Support for STOMP protocol versions: **1.2**, **1.1**, and **1.0**
|
|
36
|
+
- Support for fallback options when WebSocket is unavailable
|
|
37
|
+
- Supports both **browser** and **Node.js** environments
|
|
38
|
+
- Option to connect using **STOMP over TCP**
|
|
39
|
+
- Full support for **binary payloads**
|
|
40
|
+
- Compatible with RxJS for reactive programming
|
|
27
41
|
|
|
28
|
-
##
|
|
42
|
+
## Getting Started
|
|
43
|
+
|
|
44
|
+
This section provides a quick guide to integrating STOMP.js into your **browser** or **Node.js** application.
|
|
29
45
|
|
|
30
46
|
### Browser
|
|
31
47
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
import {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
});
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
[
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
48
|
+
To use STOMP.js in a browser:
|
|
49
|
+
|
|
50
|
+
1. Add the following in your HTML file:
|
|
51
|
+
```html
|
|
52
|
+
<script type="importmap">
|
|
53
|
+
{
|
|
54
|
+
"imports": {
|
|
55
|
+
"@stomp/stompjs": "https://ga.jspm.io/npm:@stomp/stompjs@7.0.0/esm6/index.js"
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
</script>
|
|
59
|
+
<script
|
|
60
|
+
async
|
|
61
|
+
src="https://ga.jspm.io/npm:es-module-shims@1.5.1/dist/es-module-shims.js"
|
|
62
|
+
crossorigin="anonymous"
|
|
63
|
+
></script>
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
2. Use the library:
|
|
67
|
+
```javascript
|
|
68
|
+
import { Client } from '@stomp/stompjs';
|
|
69
|
+
|
|
70
|
+
const client = new Client({
|
|
71
|
+
brokerURL: 'ws://localhost:15674/ws',
|
|
72
|
+
onConnect: () => {
|
|
73
|
+
client.subscribe('/topic/test01', message =>
|
|
74
|
+
console.log(`Received: ${message.body}`)
|
|
75
|
+
);
|
|
76
|
+
client.publish({ destination: '/topic/test01', body: 'First Message' });
|
|
77
|
+
},
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
client.activate();
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### Node.js
|
|
84
|
+
|
|
85
|
+
To use STOMP.js in a Node.js environment:
|
|
86
|
+
|
|
87
|
+
1. Install the package:
|
|
88
|
+
```bash
|
|
89
|
+
npm install @stomp/stompjs ws
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
2. Use it in your application:
|
|
93
|
+
```javascript
|
|
94
|
+
import { Client } from '@stomp/stompjs';
|
|
95
|
+
|
|
96
|
+
import { WebSocket } from 'ws';
|
|
97
|
+
Object.assign(global, { WebSocket });
|
|
98
|
+
|
|
99
|
+
const client = new Client({
|
|
100
|
+
brokerURL: 'ws://localhost:15674/ws',
|
|
101
|
+
onConnect: () => {
|
|
102
|
+
client.subscribe('/topic/test01', message =>
|
|
103
|
+
console.log(`Received: ${message.body}`)
|
|
104
|
+
);
|
|
105
|
+
client.publish({ destination: '/topic/test01', body: 'First Message' });
|
|
106
|
+
},
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
client.activate();
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
---
|
|
113
|
+
|
|
114
|
+
## Documentation
|
|
115
|
+
|
|
116
|
+
Comprehensive documentation can be found at: [STOMP.js Documentation](https://stomp-js.github.io/)
|
|
117
|
+
|
|
118
|
+
- **API Overview**: [API Docs (latest)](https://stomp-js.github.io/api-docs/latest/)
|
|
119
|
+
- **Usage Guide**: [Guide to Using STOMP.js](https://stomp-js.github.io/guide/stompjs/using-stompjs-v5.html)
|
|
120
|
+
- **Feature Guides**: Explore additional guides at [https://stomp-js.github.io/](https://stomp-js.github.io/)
|
|
105
121
|
|
|
106
122
|
## Upgrading
|
|
107
123
|
|
|
108
|
-
|
|
109
|
-
to your code. Head to
|
|
110
|
-
[Upgrading](https://stomp-js.github.io/#upgrading).
|
|
124
|
+
If you are updating from an older version of STOMP.js, review the [Upgrading Guide](https://stomp-js.github.io/#upgrading) for any required changes.
|
|
111
125
|
|
|
112
126
|
## Usage with RxJS
|
|
113
127
|
|
|
114
|
-
https://github.com/stomp-js/rx-stomp
|
|
115
|
-
offered by this library as RxJS Observables.
|
|
128
|
+
[Rx-Stomp](https://github.com/stomp-js/rx-stomp) builds upon this library, exposing all its features as **RxJS Observables**, enabling reactive programming patterns.
|
|
116
129
|
|
|
117
|
-
## TypeScript
|
|
130
|
+
## TypeScript Support
|
|
118
131
|
|
|
119
|
-
|
|
132
|
+
STOMP.js includes built-in TypeScript definitions, eliminating the need for external type definition files. Begin coding with TypeScript out-of-the-box!
|
|
120
133
|
|
|
121
|
-
##
|
|
134
|
+
## Changelog
|
|
122
135
|
|
|
123
|
-
|
|
136
|
+
Visit the [Change Log](Change-log.md) for information about changes, improvements, and fixes in recent releases.
|
|
124
137
|
|
|
125
138
|
## Contributing
|
|
126
139
|
|
|
127
|
-
|
|
128
|
-
|
|
140
|
+
Thinking of contributing to STOMP.js? Great! To get started:
|
|
141
|
+
|
|
142
|
+
- Read the [Contributing Guide](Contribute.md) for development instructions.
|
|
143
|
+
- Report bugs or suggest features by creating an issue on GitHub.
|
|
144
|
+
|
|
145
|
+
We welcome contributions from the community!
|
|
129
146
|
|
|
130
147
|
## Authors
|
|
131
148
|
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
- [Vanessa Williams](http://github.com/fridgebuzz)
|
|
149
|
+
This library is made possible by these amazing contributors:
|
|
150
|
+
|
|
135
151
|
- [Deepak Kumar](https://github.com/kum-deepak)
|
|
136
152
|
- [Astha Deep](https://github.com/astha183)
|
|
137
153
|
- [Dillon Sellars](https://github.com/dillon-sellars)
|
|
@@ -144,7 +160,15 @@ If you want to understand the code, develop, or contribute. Please visit
|
|
|
144
160
|
- [Harsh Deep](https://github.com/harsh183)
|
|
145
161
|
- [Nikos Epping](https://github.com/Nikos410)
|
|
146
162
|
- [Tom Pachtner](https://github.com/tomamatics)
|
|
163
|
+
- [David Nussio](https://github.com/davidnussio)
|
|
164
|
+
- [Camille Drapier](https://github.com/CamilleDrapier)
|
|
165
|
+
- [chai min](https://github.com/minchai23)
|
|
166
|
+
- [umsungjun](https://github.com/umsungjun)
|
|
167
|
+
- [tomek3e](https://github.com/tomek3e)
|
|
168
|
+
- [Samuel Yinger](https://github.com/GoldenSunX)
|
|
169
|
+
|
|
170
|
+
This library is originally based on [stompjs](https://github.com/jmesnil/stomp-websocket) by [Jeff Mesnil](http://jmesnil.net/) with enhancements and bug fixes from [Jeff Lindsay](http://github.com/progrium) and [Vanessa Williams](http://github.com/fridgebuzz).
|
|
147
171
|
|
|
148
172
|
## License
|
|
149
173
|
|
|
150
|
-
[
|
|
174
|
+
Licensed under the **Apache-2.0 License**. See the [LICENSE file](LICENSE) for details.
|