0.0.0-4 • Published 1 year ago

@plurid/messager v0.0.0-4

Weekly downloads
-
License
SEE LICENSE IN LI...
Repository
github
Last release
1 year ago

messager is a service or self-hosted messaging queue.

messager is intended to:

  • be a centralized, single messaging space for multi-project software systems;
  • handle publish/subscribe, notify across multiple users, tokens, domains.

messager has clients for:

The messager-server uses plurid to explore information as a 3D structure.

Contents

About

The messager client can be configured to use WebSockets, kind socket, or Server Sent Events, kind event. WebSockets can be used in browsers or in NodeJS environments; Server Sent Events can be used in browsers.

Once configured with a host, the messager server, and token, the messager client can publish, subscribe, and/or notify.

The token is generated from the messager server and can be restricted to certain origins, IPs, or use a certain key.

The subscribe/publish topics can be any string; customarily, they respect a '<domain>.<details>.<specification>:<id>' shape.

import Messager from '@plurid/messager';


const messager = new Messager(
    'messager.plurid.cloud',
    'token',
    'socket', // default 'event'
);
// // or connecting to local messager server on 'localhost:56865'
// const messager = new Messager(
//     'localhost:56865',
//     '__TEST_MODE__',
//     'event',
//     {
//         secure: false,
//     },
// );


interface Data {
    value: boolean;
}

messager.subscribe<Data>('some.topic', (data) => {
    // do things with data
    console.log(data);
});

messager.publish<Data>(
    'some.topic',
    { value: true },
);

messager.notify<Data>(
    'id-of-another-messager',
    { value: true },
);

Packages

@plurid/messager-server • the server application

@plurid/messager-client-javascript • the JavaScript client

@plurid/messager-client-python • the Python client

Codeophon