@stomp/stompjs 7.1.1 → 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 CHANGED
@@ -1,137 +1,153 @@
1
1
  # STOMP.js
2
2
 
3
- [![Firefox, Chrome](https://github.com/stomp-js/stompjs/actions/workflows/linux.yml/badge.svg?branch=develop)](https://github.com/stomp-js/stompjs/actions/workflows/linux.yml)
4
- [![Safari, Edge](https://github.com/stomp-js/stompjs/actions/workflows/osx.yml/badge.svg?branch=develop)](https://github.com/stomp-js/stompjs/actions/workflows/osx.yml)
5
- [![NodeJS Test](https://github.com/stomp-js/stompjs/actions/workflows/node-js.yml/badge.svg?branch=develop)](https://github.com/stomp-js/stompjs/actions/workflows/node-js.yml)
6
- [![API docs refresh](https://github.com/stomp-js/stompjs/actions/workflows/docs-refresh.yml/badge.svg?branch=develop)](https://github.com/stomp-js/stompjs/actions/workflows/docs-refresh.yml)
3
+ [![Build Status - Firefox, Chrome](https://github.com/stomp-js/stompjs/actions/workflows/linux.yml/badge.svg?branch=develop)](https://github.com/stomp-js/stompjs/actions/workflows/linux.yml)
4
+ [![Build Status - Safari, Edge](https://github.com/stomp-js/stompjs/actions/workflows/osx.yml/badge.svg?branch=develop)](https://github.com/stomp-js/stompjs/actions/workflows/osx.yml)
5
+ [![Node.js Tests](https://github.com/stomp-js/stompjs/actions/workflows/node-js.yml/badge.svg?branch=develop)](https://github.com/stomp-js/stompjs/actions/workflows/node-js.yml)
6
+ [![API Docs Refresh](https://github.com/stomp-js/stompjs/actions/workflows/docs-refresh.yml/badge.svg?branch=develop)](https://github.com/stomp-js/stompjs/actions/workflows/docs-refresh.yml)
7
7
 
8
- This library provides a STOMP over WebSocket client for Web browser and node.js applications.
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
- Please visit https://stomp-js.github.io/ for guides, FAQs and API docs.
10
+ ## Table of Contents
11
11
 
12
- # Introduction
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
- This library allows you to connect to a STOMP broker over WebSocket. This library
15
- supports complete STOMP specifications including all current protocol variants. Most
16
- popular messaging brokers support STOMP and STOMP over WebSockets out-of-the-box
17
- or using plugins.
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 to interact with the Stomp protocol
22
- - Support for v1.2, v1.1 and v1.0 of the Stomp protocol
23
- - Support for fallback options in case of WebSocket unavailable
24
- - Browser and Node.js support
25
- - Option to use STOMP over TCP
26
- - Binary payload support
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
- ## Usage
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
- ```html
33
- <!--
34
- JSPM Generator Import Map
35
- Edit URL: https://generator.jspm.io/#U2NgYGBkDM0rySzJSU1hcCguyc8t0AeTWcUO5noGega6SakliaYAYTzJAykA
36
- -->
37
- <script type="importmap">
38
- {
39
- "imports": {
40
- "@stomp/stompjs": "https://ga.jspm.io/npm:@stomp/stompjs@7.0.0/esm6/index.js"
41
- }
42
- }
43
- </script>
44
-
45
- <!-- ES Module Shims: Import maps polyfill for modules browsers without import maps support (all except Chrome 89+) -->
46
- <script
47
- async
48
- src="https://ga.jspm.io/npm:es-module-shims@1.5.1/dist/es-module-shims.js"
49
- crossorigin="anonymous"
50
- ></script>
51
-
52
- <script type="module">
53
- import { Client } from '@stomp/stompjs';
54
-
55
- const client = new Client({
56
- brokerURL: 'ws://localhost:15674/ws',
57
- onConnect: () => {
58
- client.subscribe('/topic/test01', message =>
59
- console.log(`Received: ${message.body}`)
60
- );
61
- client.publish({ destination: '/topic/test01', body: 'First Message' });
62
- },
63
- });
64
-
65
- client.activate();
66
- </script>
67
- ```
68
-
69
- ### NodeJS
70
-
71
- ```bash
72
- $ npm install @stomp/stompjs ws
73
- ```
74
-
75
- ```javascript
76
- import { Client } from '@stomp/stompjs';
77
-
78
- import { WebSocket } from 'ws';
79
- Object.assign(global, { WebSocket });
80
-
81
- const client = new Client({
82
- brokerURL: 'ws://localhost:15674/ws',
83
- onConnect: () => {
84
- client.subscribe('/topic/test01', message =>
85
- console.log(`Received: ${message.body}`)
86
- );
87
- client.publish({ destination: '/topic/test01', body: 'First Message' });
88
- },
89
- });
90
-
91
- client.activate();
92
- ```
93
-
94
- ## Further information
95
-
96
- The API documentation is hosted as GitHub pages for the StompJS family of libraries.
97
- You may head straight to the https://stomp-js.github.io/api-docs/latest/
98
-
99
- This library comes with detailed usage instructions. Please find it at
100
- [Usage instructions](https://stomp-js.github.io/guide/stompjs/using-stompjs-v5.html).
101
- Check out other guides at https://stomp-js.github.io/.
102
-
103
- There is quite detailed API documentation,
104
- you should start at https://stomp-js.github.io/api-docs/latest/classes/Client.html.
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
- if you were using an older version of this library, you would need to make changes
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 is based on this library and exposes the entire functionality
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 definitions
130
+ ## TypeScript Support
118
131
 
119
- The npm package includes TypeScript definitions, so there is no need to install it separately.
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
- ## Change-log
134
+ ## Changelog
122
135
 
123
- Please visit [Change Log](Change-log.md).
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
- If you want to understand the code, develop, or contribute. Please visit
128
- [How to contribute](Contribute.md).
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
- - [Jeff Mesnil](http://jmesnil.net/)
133
- - [Jeff Lindsay](http://github.com/progrium)
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)
@@ -145,7 +161,14 @@ If you want to understand the code, develop, or contribute. Please visit
145
161
  - [Nikos Epping](https://github.com/Nikos410)
146
162
  - [Tom Pachtner](https://github.com/tomamatics)
147
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).
148
171
 
149
172
  ## License
150
173
 
151
- [License](LICENSE) - Apache-2.0
174
+ Licensed under the **Apache-2.0 License**. See the [LICENSE file](LICENSE) for details.