pipe-hermes
Version:
Simple pub sub messaging tool
72 lines (44 loc) • 1.35 kB
Markdown
A light weight message broker that uses the publisher and subscriber pattern to deliver messages within services.
Install pipe-hermes with npm
```bash
npm install pipe-hermes
```
```javascript
import Hermes from 'pipe-hermes'
```
```javascript
import { HermesSubscriber } from 'pipe-hermes'
const ApplicationConfig = {
host: 'broker.pipemessenger.xyz',
port: 5670,
hermesKey: '/*KEY USED BY THE ENIGMA CLI*/',
hermesToken: '/*GENERATED BY THE ENIGMA CLI*/'
};
const subscriber = new HermesSubscriber(ApplicationConfig);
subscriber.on('add-to-cart', (message) => {
console.log('Item added to cart:', message);
});
```
```javascript
import { HermesPublisher } from 'pipe-hermes'
const ApplicationConfig = {
host: 'broker.pipemessenger.xyz',
port: 5670,
hermesKey: '/*KEY USED BY THE ENIGMA CLI*/',
hermesToken: '/*GENERATED BY THE ENIGMA CLI*/'
};
const publisher = new HermesPublisher(ApplicationConfig);
publisher.deliver<string>('add-to-cart', 'Hello World!');
```
Use the engima cli tool to generate your hermes token using your key
[](https://github.com/pipethedev/enigma)
**Server:** NodeJS, GoLang
I just write codes that give me headaches...