mesh-remote-bus
TypeScript icon, indicating that this package has built-in type declarations

2.0.10 • Public • Published

This is an adapter bus for remote protocols such as socket.io, websockets, pubnub, etc.

Installation: npm install mesh-remote-bus

Example:

import RemoteBus from 'mesh-remote-bus';
import { WrapBus } from 'mesh';
import createSocketIoClient from 'socket.io-client';
 
var client = createSocketIo('http://12.0.0.1:8080');
 
var adapter = {
  addListener(listener) {
    client.on('message', listener);
  },
  send(message) {
    client.send('message', message);
  }
};
 
var localBus = WrapBus.create(function() {
  return 'hello!';
});
 
var bus = RemoteBus.create(adapter, localBus);
 
bus.execute({ }).read().then(function({value}) {
  console.log(value);
})

Readme

Keywords

none

Package Sidebar

Install

npm i mesh-remote-bus

Weekly Downloads

1

Version

2.0.10

License

ISC

Last publish

Collaborators

  • architectd
  • crcn