# @stomp/stompjs

> STOMP client for Javascript and Typescript

Latest version **7.3.0** (published 2026-01-31) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install @stomp/stompjs
pnpm add @stomp/stompjs
yarn add @stomp/stompjs
bun add @stomp/stompjs
```

## Health

**Score 65/100 (B)** — status: stable.

Positive: has types; esm support; no vulnerabilities; has provenance; high quality score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 7.3.0 |
| Published | 2026-01-31 |
| First published | 2017-03-28 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 462.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 888 |
| Author | deepak@kreatio.com |
| Maintainers | stomp-js, kdeepak |
| Keywords | STOMP, RabbitMQ, ActiveMQ, Websocket, messaging, queue, SockJS |

## Links

- npm: https://www.npmjs.com/package/@stomp/stompjs
- Repository: https://github.com/stomp-js/stompjs
- Homepage: https://github.com/stomp-js/stompjs#readme
- Issues: https://github.com/stomp-js/stompjs/issues
- npm.io page: https://npm.io/package/@stomp/stompjs

## Alternatives

- [@opentelemetry/exporter-zipkin](https://npm.io/package/@opentelemetry/exporter-zipkin.md) — 14.8M weekly downloads
- [pusher-js](https://npm.io/package/pusher-js.md) — 2.0M weekly downloads
- [browserify](https://npm.io/package/browserify.md) — 1.7M weekly downloads
- [sqs-consumer](https://npm.io/package/sqs-consumer.md) — 1.7M weekly downloads
- [@sanity/eventsource](https://npm.io/package/@sanity/eventsource.md) — 930.8K weekly downloads

## Recent versions

- 7.3.0 (latest) — 2026-01-31
- 7.4.0-beta.2 (beta) — 2026-05-07
- 7.4.0-beta.1 — 2026-05-07
- 7.3.0-beta.4 — 2026-01-31
- 7.3.0-beta.3 — 2026-01-31
- 7.3.0-beta.2 — 2025-12-26
- 7.2.2-beta.1 — 2025-11-20
- 7.2.1 — 2025-10-12
- 7.2.0 — 2025-09-15
- 7.1.1 — 2025-04-06
- 7.1.0 — 2025-03-22
- 7.0.1 — 2025-03-09
- 7.0.0 — 2023-02-08
- 7.0.0-beta5 — 2023-01-31
- 7.0.0-beta4 — 2023-01-27
- … 44 more at https://npm.io/package/@stomp/stompjs/versions

## README

# STOMP.js

[![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)
[![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)
[![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)
[![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)

**STOMP.js** is a fully-fledged STOMP over WebSocket library for **browsers** and **Node.js**, providing seamless integration with STOMP protocol-compliant messaging brokers.

## Table of Contents

- [Introduction](#introduction)
- [Features](#features)
- [Getting Started](#getting-started)
    - [Browser](#browser)
    - [Node.js](#nodejs)
- [Documentation](#documentation)
- [Upgrading](#upgrading)
- [Usage with RxJS](#usage-with-rxjs)
- [TypeScript Support](#typescript-support)
- [Changelog](#changelog)
- [Contributing](#contributing)
- [Authors](#authors)
- [License](#license)

## Introduction

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.

Popular brokers like RabbitMQ, ActiveMQ, and others provide support for STOMP and STOMP over WebSockets out-of-the-box.

## Features

- Simple and intuitive API for interacting with the STOMP protocol
- Support for STOMP protocol versions: **1.2**, **1.1**, and **1.0**
- Support for fallback options  when WebSocket is unavailable
- Supports both **browser** and **Node.js** environments
- Option to connect using **STOMP over TCP**
- Full support for **binary payloads**
- Compatible with RxJS for reactive programming

## Getting Started

This section provides a quick guide to integrating STOMP.js into your **browser** or **Node.js** application.

### Browser

To use STOMP.js in a browser:

1. Add the following in your HTML file:
   ```html
   <script type="importmap">
     {
       "imports": {
         "@stomp/stompjs": "https://ga.jspm.io/npm:@stomp/stompjs@7.0.0/esm6/index.js"
       }
     }
   </script>
   <script
     async
     src="https://ga.jspm.io/npm:es-module-shims@1.5.1/dist/es-module-shims.js"
     crossorigin="anonymous"
   ></script>
   ```

2. Use the library:
   ```javascript
   import { Client } from '@stomp/stompjs';

   const client = new Client({
     brokerURL: 'ws://localhost:15674/ws',
     onConnect: () => {
       client.subscribe('/topic/test01', message =>
         console.log(`Received: ${message.body}`)
       );
       client.publish({ destination: '/topic/test01', body: 'First Message' });
     },
   });

   client.activate();
   ```

### Node.js

To use STOMP.js in a Node.js environment:

1. Install the package:
   ```bash
   npm install @stomp/stompjs ws
   ```

2. Use it in your application:
   ```javascript
   import { Client } from '@stomp/stompjs';

   import { WebSocket } from 'ws';
   Object.assign(global, { WebSocket });

   const client = new Client({
     brokerURL: 'ws://localhost:15674/ws',
     onConnect: () => {
       client.subscribe('/topic/test01', message =>
         console.log(`Received: ${message.body}`)
       );
       client.publish({ destination: '/topic/test01', body: 'First Message' });
     },
   });

   client.activate();
   ```

---

## Documentation

Comprehensive documentation can be found at: [STOMP.js Documentation](https://stomp-js.github.io/)

- **API Overview**: [API Docs (latest)](https://stomp-js.github.io/api-docs/latest/)
- **Usage Guide**: [Guide to Using STOMP.js](https://stomp-js.github.io/guide/stompjs/using-stompjs-v5.html)
- **Feature Guides**: Explore additional guides at [https://stomp-js.github.io/](https://stomp-js.github.io/)

## Upgrading

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.

## Usage with RxJS

[Rx-Stomp](https://github.com/stomp-js/rx-stomp) builds upon this library, exposing all its features as **RxJS Observables**, enabling reactive programming patterns.

## TypeScript Support

STOMP.js includes built-in TypeScript definitions, eliminating the need for external type definition files. Begin coding with TypeScript out-of-the-box!

## Changelog

Visit the [Change Log](Change-log.md) for information about changes, improvements, and fixes in recent releases.

## Contributing

Thinking of contributing to STOMP.js? Great! To get started:

- Read the [Contributing Guide](Contribute.md) for development instructions.
- Report bugs or suggest features by creating an issue on GitHub.

We welcome contributions from the community!

## Authors

This library is made possible by these amazing contributors:

- [Deepak Kumar](https://github.com/kum-deepak)
- [Astha Deep](https://github.com/astha183)
- [Dillon Sellars](https://github.com/dillon-sellars)
- [Jimi Charalampidis](https://github.com/jimic)
- [Raul](https://github.com/rulonder)
- [Dimitar Georgiev](https://github.com/iMitaka)
- [Genadi](https://github.com/genadis)
- [Bobohuochai](https://github.com/bobohuochai)
- [Sailai](https://github.com/sailai)
- [Harsh Deep](https://github.com/harsh183)
- [Nikos Epping](https://github.com/Nikos410)
- [Tom Pachtner](https://github.com/tomamatics)
- [David Nussio](https://github.com/davidnussio)
- [Camille Drapier](https://github.com/CamilleDrapier)
- [chai min](https://github.com/minchai23)
- [umsungjun](https://github.com/umsungjun)
- [tomek3e](https://github.com/tomek3e)
- [Samuel Yinger](https://github.com/GoldenSunX)
- [RokkieBrown](https://github.com/rokkie)
- [Alexey](https://github.com/Al-ex-ei)

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

## License

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

---
_Source: https://npm.io/package/@stomp/stompjs · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
