Socket
Socket
Sign inDemoInstall

@eccenca/messagebus

Package Overview
Dependencies
5
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @eccenca/messagebus

Eccenca Message Bus for inter-component and in-app communications.


Version published
Weekly downloads
2
increased by100%
Maintainers
1
Install size
17.8 MB
Created
Weekly downloads
 

Changelog

Source

[5.0.0] 2018-02-06

Changed

  • BREAKING: updated to rxjs 5.0.0

Removed

  • BREAKING: createChannels experiment
  • BREAKING: rxmq.js middleware capabilities, as we never really used them

Readme

Source

Eccenca Message Bus for inter-component and in-app communications

ecc-messagebus exports a normal rxmq.js instance but with a set of additional functions. For convenience it also exports Rx so that we can use a fixed Rx version in all components.

Using Rx

import {Rx} from 'ecc-messagebus';

var source = Rx.Observable.just(42);

var subscription = source.subscribe(
  function (x) {
    console.log(`Next: ${x}');
  },
  function (err) {
    console.log(`Error: ${err}`);
  },
  function () {
    console.log('Completed');
  });

// => Next: 42
// => Completed

Using request-response

Request-response pattern can be used like so:

import rxmq from 'ecc-messagebus';
// ...
// get channel
const channel = rxmq.channel('yourChannel');
// subscribe to topic
channel.subject('someTopic').subscribe(({data, replySubject}) => {
    // ...
    // use envelop.reply to send response
    replySubject.onNext({some: 'response'});
    replySubject.onCompleted();
});
// ...
// initiate request and handle response as a promise
channel.request({
    topic: 'someTopic',
    data: {test: 'test'},
    timeout: 2000
})
.subscribe((data) => {
    // work with data here
    // ...
},
(err) => {
    // catch and handle error here
    // ...
});

FAQs

Last updated on 06 Feb 2018

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc