UNPKG

pipe-hermes

Version:
72 lines (44 loc) 1.35 kB
# Hermes A light weight message broker that uses the publisher and subscriber pattern to deliver messages within services. ## Installation Install pipe-hermes with npm ```bash npm install pipe-hermes ``` ## Usage/Examples ```javascript import Hermes from 'pipe-hermes' ``` ### Subscriber ```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); }); ``` ### Publisher ```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!'); ``` ## Documentation Use the engima cli tool to generate your hermes token using your key [Engima CLI Tool](https://github.com/pipethedev/enigma) ## Tech Stack **Server:** NodeJS, GoLang ## 🚀 About Me I just write codes that give me headaches...