rvl-pubsub

0.1.0 • Public • Published

rvl-pubsub

Revelat.io API for publishing pubsub events

This lib exposes a single function that allows you to send pubsub messages to the right project/channel.

Usage

Import the module and call the function. Is that simple, of course you need to have the right env vars set

const { publish } = require('rvl-pubsub')

publish('my-app-back', 'create-doc', {name: 'Hello World'})
    .then(result => {
        console.log(result)     // Usually in the form {status: 'ok'}
    })
    .catch(err => {
        console.log(err)
    })

Pubsub consumers can parse the message payload from JSON and obtain both the type and original data as:

{
    "type": "create-doc",
    "payload": {
        "name": "Hello World"
    }
}

The concept of topic is equivalent to type so no need to worry about topics (for the moment)

You will need this two env vars:

  • ENV_CHANNEL then environment you want to send messages
  • REVELATIO_AUTH_TOKEN the revelatio authentication token

Usually you can have this two in a .env file that can be generated using the rvl-dev CLI tool.

Readme

Keywords

Package Sidebar

Install

npm i rvl-pubsub

Weekly Downloads

1

Version

0.1.0

License

ISC

Unpacked Size

129 kB

Total Files

5

Last publish

Collaborators

  • ernestofreyreg