An event-bus based on the WHATWG's BroadcastChannel API.
The core
module is a basic framework for creating, caching and clean-up of the underlying channel instances.
The cluster
module is currently a work-in-progress, with the goal of coordination in a cluster of distributed WhatBus instances. Some implemented, partially complete, and planned features:
- Rendezvous hashing
- Raft consensus
- distributed Maps, Sets, executors
- data replication & failover
- distributed queues, transactions
import WhatBus from "./core.ts"
const wb = new WhatBus('wb:')
let s1 = wb.subscribe('t:1', event => console.log('s1', event.data))
wb.subscribeOnce('t:1', /* ... */)
wb.publish('t:1', { m: 100 })
wb.close()
import { create } from "./cluster.ts"
const wb = await create('twb:')
// @todo: cluster examples
- BroadcastChannel
This project is licensed under the terms of the MIT license.