@wedevelop/web-sub

1.0.0 • Public • Published

web-sub

JavaScript Style Guide

Simple WebSub client for Node.js. It provides publish and subscribe methods.

Installation

Also, you'll need to install an adapter. For the moment the only available adapter is web-sub-kafka-adapter.

This package could be extended to use any other apdater such as RabbitMQ, SQS, ActiveMQ, etc.

npm install --save @wedevelop/web-sub @wedevelop/web-sub-kafka-adapter

Quick start

const WebSubClient = require('@wedevelop/web-sub')
const KafkaAdapter = require('@wedevelop/web-sub-kafka-adapter')

const topic = 'demo'
const webSubClient = new WebSubClient(new KafkaAdapter())

webSubClient.publish([{ topic, messages: [new Date()] }])
  .then(console.log)
  .catch(console.error)

webSubClient.subscribe(topic, (err, data) => {
  if (err) {
    console.error(err)
  } else {
    console.log(data)
  }
})

Dependencies (0)

    Dev Dependencies (6)

    Package Sidebar

    Install

    npm i @wedevelop/web-sub

    Weekly Downloads

    1

    Version

    1.0.0

    License

    ISC

    Unpacked Size

    3.35 kB

    Total Files

    5

    Last publish

    Collaborators

    • nahuel-wedevelop
    • roke77
    • mpautasso
    • armandograterol
    • sergioshev
    • aosorio