Skip to content

Commit afeb782

Browse files
author
Deepak Kumar
committed
Enhance README.md with structured content, improved formatting, and expanded documentation, while fixing minor typos in stomp-headers.ts.
1 parent 62cc41a commit afeb782

2 files changed

Lines changed: 125 additions & 107 deletions

File tree

README.md

Lines changed: 124 additions & 106 deletions
Original file line numberDiff line numberDiff line change
@@ -1,137 +1,153 @@
11
# STOMP.js
22

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)
77

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.
99

10-
Please visit https://stomp-js.github.io/ for guides, FAQs and API docs.
10+
## Table of Contents
1111

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)
1325

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.
1831

1932
## Features
2033

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
2741

28-
## Usage
42+
## Getting Started
43+
44+
This section provides a quick guide to integrating STOMP.js into your **browser** or **Node.js** application.
2945

3046
### Browser
3147

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/)
105121

106122
## Upgrading
107123

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.
111125

112126
## Usage with RxJS
113127

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.
116129

117-
## TypeScript definitions
130+
## TypeScript Support
118131

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!
120133

121-
## Change-log
134+
## Changelog
122135

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.
124137

125138
## Contributing
126139

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!
129146

130147
## Authors
131148

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+
135151
- [Deepak Kumar](https://github.com/kum-deepak)
136152
- [Astha Deep](https://github.com/astha183)
137153
- [Dillon Sellars](https://github.com/dillon-sellars)
@@ -151,6 +167,8 @@ If you want to understand the code, develop, or contribute. Please visit
151167
- [tomek3e](https://github.com/tomek3e)
152168
- [Samuel Yinger](https://github.com/GoldenSunX)
153169

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).
171+
154172
## License
155173

156-
[License](LICENSE) - Apache-2.0
174+
Licensed under the **Apache-2.0 License**. See the [LICENSE file](LICENSE) for details.

src/stomp-headers.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* STOMP headers. Many functions calls will accept headers as parameters.
2+
* STOMP headers. Many function calls will accept headers as parameters.
33
* The headers sent by Broker will be available as [IFrame#headers]{@link IFrame#headers}.
44
*
55
* `key` and `value` must be valid strings.

0 commit comments

Comments
 (0)