Module: skyring/lib/nats

Small wrapper around nats for quickly connecting / disconnecting

Since:
  • 1.0.0
Author:
  • Eric Satterwhite
Source:

Example

const nats= require('skyring/lib/nats')
const client = nats.createClient()
client.publish('foobar', JSON.stringify({'foo':'bar'}), () => {
  nats.quit()
})

Requires

Methods


createClient( [options])

Creates a new nats client

Parameters:
Name Type Argument Description
options Object <optional>

nats client configuration

Properties
Name Type Argument Default Description
hosts String <optional>
localhost:4222

a comma separated list of addresses of nats hosts to connect to

Source:
Returns:

A nats client instance

Type
NatsClient
Example
nats.createClient({
  hosts:'nats-1.domain.com:4222,nats-2.domain.com:4223,localhost:4222'
})