@lejeunerenard/kappa-core-event-bus
v1.0.0
Published
A peer-to-peer event bus.
Downloads
1
Maintainers
Readme
Kappa Event Bus
A kappa-core based event bus node for sending messages to all nodes on a peer-to-peer network. This creates a network wide event emitter with eventual consistency.
Usage
Node A
const EventBus = require('@lejeunerenard/kappa-core-event-bus')
const bus = new EventBus('network-name')
const data = {
foo: 'bar'
}
bus.emit('event-name', data)
Node B
const EventBus = require('@lejeunerenard/kappa-core-event-bus')
const bus = new EventBus('network-name')
bus.on('event-name', (data) => {
console.log('foo', data.foo) // prints: bar
})
License
ISC