Skip to content

The MessageBroker is a typescript library for providing asynchronous communication throughout your app

License

Notifications You must be signed in to change notification settings

morganstanley/message-broker

Folders and files

NameName
Last commit message
Last commit date
Jan 14, 2025
Nov 16, 2023
Nov 20, 2023
Jan 14, 2025
Nov 21, 2023
Aug 6, 2024
Apr 24, 2024
Nov 20, 2023
Nov 16, 2023
Nov 16, 2023
Nov 16, 2023
Nov 16, 2023
Nov 20, 2023
Nov 20, 2023
Jan 22, 2025
Nov 20, 2023
Oct 28, 2024
Nov 20, 2023
Nov 20, 2023

MessageBroker

Lifecycle Active NPM npm NPM Build Status OpenSSF Scorecard

MessageBroker provides framework agnostic, decoupled communication between publishers and subscribers. This library is fully type safe and works in both browsers and Node.js. MessageBroker is built ontop of RxJS providing access to observables and a comprehensive list of operators.

Full documentation can be found at https://morganstanley.github.io/message-broker/

Basic Usage

First, install the message-broker

npm install @morgan-stanley/message-broker

then you can start sending and receiving messages like this

import { messagebroker, IMessageBroker } from '@morgan-stanley/message-broker';

interface IContracts {
    myChannel: {
        payload: string;
    };
}

const broker: IMessageBroker<IContracts> = messagebroker<IContracts>();

broker.get('myChannel').subscribe((message) => {
    console.log(message.payload);
});

broker.create('myChannel').publish({
    payload: 'My first message using the MessageBroker!',
});

Development

For guidelines on how to contribute please click here. Here are a list of commands to run if you are interested in developing or contributing to the project.

npm install // Install all package dependencies.

npm run test // Run tests on the command line.

npm run watch-test // Run tests in watch mode.

npm run lint // Checks the code for lint errors.

npm run build // Run a simple build.

npm run watch-build // Run build in watch mode.

npm run build-release // Run a full build (Compile, Tests, Lint).