makler

Buffered, multi-topic message broker

Usage no npm install needed!

<script type="module">
  import makler from 'https://cdn.skypack.dev/makler';
</script>

README

Makler

Multi topic message broker

Makler is a functional multi topic buffered message broker written in TypeScript. It runs in the browser, or on the server using node.js.

Setup

yarn add makler

or

npm install --save makler

Usage

Before you start import the library

import { create, topic, publish, subscribe } from 'makler'

Basic usage

// Setup a new bus with no buffer
const broker = create()
const chan = topic(broker, ['topic'])

// Data published can be anything
const context = { test: true }

// Setup a subscriber
const ubsubscribe = subscribe(broker, (data, topic) => {
  console.log(data, topic) // { test: true } ["topic"]
})

// Publish some data
publish(chan, context)

// Cleanup
unsubsribe()

License

MIT