A communication bus for cross-document communication based on pub/sub model.
npm install immutable-bus
import { ImmutableBus } from 'immutable-bus';
let immutableBus = new ImmutableBus("http://self");
immutableBus.connectTo("http://window-1");
immutableBus.publish("message-topic",
"http://window-1", {
"msg": "hello from host 1"
});
let immutableBus = new ImmutableBus("http://self");
immutableBus.connectTo("http://window-1");
immutableBus.connectTo("http://window-2");
immutableBus.subscribe('message-topic', (data) => {
console.log(data); //prints any data from either windows
});
import { ImmutableBus } from 'immutable-bus';
let immutableBus = new ImmutableBus("http://self");
immutableBus.broadcast("message-topic", {
"msg": "hello from controller"
});