# stompit

> STOMP client library for node.js

Latest version **1.0.0** (published 2020-03-13) · MIT license · 0 weekly downloads

## Install

```sh
npm install stompit
pnpm add stompit
yarn add stompit
bun add stompit
```

## Health

**Score 23/100 (F)** — status: abandoned.

Positive: has types package; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2020-03-13 |
| First published | 2013-06-03 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | separate (@types/stompit) |
| Module format | CommonJS |
| Node | >=8.6.0 |
| Dependencies | 1 |
| Unpacked size | 312.9 KB |
| Known vulnerabilities | 0 (+4 in 1 direct dependencies) |
| Install scripts | no |
| Maintainers | gdaws |
| Keywords | stomp, messaging, activemq, rabbitmq |

## Links

- npm: https://www.npmjs.com/package/stompit
- Repository: https://github.com/gdaws/node-stomp
- Homepage: https://github.com/gdaws/node-stomp#readme
- Issues: https://github.com/gdaws/node-stomp/issues
- npm.io page: https://npm.io/package/stompit

## Dependencies (1)

- [qs](https://npm.io/package/qs.md) ~6.9.1

## Recent versions

- 1.0.0 (latest) — 2020-03-13
- 0.26.0 — 2018-09-18
- 0.25.0 — 2017-03-13
- 0.24.0 — 2016-10-26
- 0.23.0 — 2016-05-02
- 0.22.0 — 2015-07-23
- 0.21.0 — 2015-03-16
- 0.20.0 — 2015-02-26
- 0.19.0 — 2014-10-20
- 0.18.3 — 2014-08-11
- 0.18.2 — 2014-08-10
- 0.18.1 — 2014-03-13
- 0.18.0 — 2014-03-12
- 0.17.0 — 2014-03-12
- 0.16.0 — 2014-01-20
- … 27 more at https://npm.io/package/stompit/versions

## README

# stompit [![Build Status](https://travis-ci.org/gdaws/node-stomp.png)](https://travis-ci.org/gdaws/node-stomp)

A STOMP client library for Node.js that is fully compatible with STOMP 1.0, 1.1 
and 1.2 servers. The library provides optional fault tolerance features such as 
multiple server failover and persistent subscriptions and message publishing 
across failure events. The API is designed to be consistent with idiomatic 
Node.js code. Messages are stream oriented. The client supports any 
stream.Duplex transport, such as for example tls.TLSSocket.

An example of sending and receiving a message using the client API:
```javascript
const stompit = require('stompit');

const connectOptions = {
  'host': 'localhost',
  'port': 61613,
  'connectHeaders':{
    'host': '/',
    'login': 'username',
    'passcode': 'password',
    'heart-beat': '5000,5000'
  }
};

stompit.connect(connectOptions, function(error, client) {
  
  if (error) {
    console.log('connect error ' + error.message);
    return;
  }
  
  const sendHeaders = {
    'destination': '/queue/test',
    'content-type': 'text/plain'
  };
  
  const frame = client.send(sendHeaders);
  frame.write('hello');
  frame.end();
  
  const subscribeHeaders = {
    'destination': '/queue/test',
    'ack': 'client-individual'
  };
  
  client.subscribe(subscribeHeaders, function(error, message) {
    
    if (error) {
      console.log('subscribe error ' + error.message);
      return;
    }
    
    message.readString('utf-8', function(error, body) {
      
      if (error) {
        console.log('read message error ' + error.message);
        return;
      }
      
      console.log('received message: ' + body);
      
      client.ack(message);
      
      client.disconnect();
    });
  });
});

```

## Install

```
npm install --save stompit
```

## Documentation

* [API documentation](http://gdaws.github.io/node-stomp/api/)

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