Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

nsq-publisher

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nsq-publisher

Simple way to create topics and publish messages in NSQ

  • 1.0.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

NSQ Publisher

Build Status Coverage Status Dependency Status

Simple way to create topics and publish messages.

Installation

npm instal --save nsq-publisher

Usage

const Publisher = require('nsq-publisher');


const pub = new Publisher({
  dataUrl: 'localhost', // optional 
  dataHttpPort: 4151, // optional 
  dataTcpPort: 4150, // optional 
  topic: 'test-topic', 
  protocol: 'http', // optional 
  autoCreate: false // optional
});




// pub.createTopic is necessary to make sure that topic exists, 
// but is not necessary if autoCreate is set to true
pub.createTopic(function (err) {
  if (err) {
  	console.error(err);
  } else {
  	console.log('ok');
  }
});
// or
pub.createTopic()
  .then(() => console.log('ok'))
  .catch(err => console.error(err));
  
  
pub.publish('test message', function (err) {
  if (err) {
  	console.error(err);
  } else {
  	console.log('published');
  }
});

// or

pub.publish('test message')
  .then(() => console.log('published'))
  .catch(err => console.error(err));

Keywords

FAQs

Package last updated on 25 Apr 2017

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc