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

larvitamintercom

Package Overview
Dependencies
Maintainers
1
Versions
133
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

larvitamintercom

[![Build Status](https://travis-ci.org/larvit/larvitamintercom.svg?branch=master)](https://travis-ci.org/larvit/larvitamintercom) [![Dependencies](https://david-dm.org/larvit/larvitamintercom.svg)](https://david-dm.org/larvit/larvitamintercom.svg)

  • 0.0.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
369
increased by59.05%
Maintainers
1
Weekly downloads
 
Created
Source

Build Status Dependencies

Larvitamintercom

Communication wrapper for rabbitmq in autobahn.

Usage

Send

send() to autobahn.

const	Intercom	= require('larvitamintercom'),
	conStr	= 'amqp://user:password@192.168.0.1/',
	intercom	= new Intercom(conStr);

let	message	= {'hello':	'world'},
	options	= {'exchange':	'foo'}; // Will default to "default" if options is omitted

intercom.send(message, options, function(err) {
	// called when message is accepted by queue handler
}, function(err) {
	// called when all consumeres have acked the message
});
Default send options:
{
	'exchange':	'default',
	'durable':	true
}

Read

There are two types of read operations; "consume" and "subscribe".

A message can only be "consumed" once, but it can be "subscribed" several times, by different readers.

Consumers can be assigned to an exchanged after the message have been sent, and they still receive the message.

Subscribers, in contrast, must subscribe BEFORE the message is sent or they will not receive it.

Each subscriber only get each message once.

Consume
const	Intercom	= require('larvitamintercom'),
	conStr	= 'amqp://user:password@192.168.0.1/',
	intercom	= new Intercom(conStr);

let options = {'exchange': 'foo'}; // Will default to "default" if options is omitted

intercom.consume(options, function(message, ack) {
	// message being the object sent with intercom.send()

	// Must be ran! Always! ACK!!
	ack();
	// or
	ack(new Error('Something was wrong with the message'));
}, function(err) {
	// Callback from established consume connection
});

Default consume options:
{
	'exchange':	'default'
}
Subscribe
const	Intercom	= require('larvitamintercom').Intercom,
	conStr	= 'amqp://user:password@192.168.0.1/',
	intercom	= new Intercom(conStr);

let options = {'exchange': 'default'};

intercom.subscribe(options, function(message, ack) {
	// message subscribe the object sent with intercom.send()

	// Must be ran! Always! ACK!!
	ack();
	// or
	ack(new Error('Something was wrong with the message'));
}, function(err) {
	// Callback from established subscribe connection
});
Default subscribe options:
{
	'exchange':	'default'
}

FAQs

Package last updated on 07 Oct 2016

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