API Docs for: 0.0.1
Show:

Node Class

Defined in: core/node.js:14
Module: core

The node is the building block of gossip.

Each node consists of a hub. A hub an abstraction built out of a router and pub socket that allows 1-N request-reply and fire-forget messaging.

Constructor

Node

(
  • [options]
)

Defined in core/node.js:14

Parameters:

  • [options] Object | String optional
    • [id] String optional

      Should uniquely identify the node in the cluster.

    • [endpoints] Object optional
      • [router] String optional
        The router socket to bind to (ipc://..., tcp://...).
      • [pub] String optional
        The pub socket to bind to.
    • [name] String optional

      A name for the node, not necessarily unique.

    • [keepalive] Object optional
      • [period] Number optional
        How often to send keepalives to the cluster.

Item Index

Methods

Methods

on

(
  • type
  • [options]
  • cb
)
Node chainable

Defined in core/node.js:298

Subscribe to messages from other nodes.

Parameters:

  • type String

    The type of message.

  • [options] Object | Function optional
    • [period] Number optional

      Maximum time another node will wait for an answer before retrying.

    • [attempts] Number optional

      Maximum attempts

  • cb Function

    Callback to execute when a message is received.

Returns:

Node:

start

() Node chainable

Defined in core/node.js:171

Starts the node.

Internally, it initializes the sockets and internal listeners, transitions the node the STARTED state and flushes queued join() calls.

Returns:

Node:

stop

() Node chainable

Defined in core/node.js:196

Stops the node. Once a node is stopped, it can't be started again. If you want to temporarily stop receiving messages, see .pause() and .unpause().

This removes all message listeners and the node transitions to the STOPPED state.

Returns:

Node:

Properties

DEFAULT_KEEPALIVE_PERIOD

Number static

Defined in core/node.js:998

How often this node will notify the cluster of it's aliveness, in milliseconds.

Default: 1000

hub

Hub

Defined in core/node.js:59

options

Object

Defined in core/node.js:34