Class: Broker

Broker(hosts, uniqueIdopt, portopt)

Represents a DXL message broker. Instances of this class are created for the purpose of connecting to the DXL fabric.

There are several ways to create broker instances:

Constructor

new Broker(hosts, uniqueIdopt, portopt)

Parameters:
Name Type Attributes Default Description
hosts Array.<string> | String

A single (or array of) host name / IP address string(s)

uniqueId String <optional>
null

An optional unique identifier for the broker, used to identify the broker in log messages, etc.

port Number | String <optional>
8883

The port of the broker.

Source:
Throws:

If the port is not valid - for example, not in the well-known IANA TCP port range (1 - 65535) or cannot be converted to a numeric value.

Type
MalformedBrokerError

Members

hosts :Array.<String>

Array of host name / IP address string(s)

Type:
  • Array.<String>
Source:

port :Number

The port of the broker

Type:
  • Number
Source:

uniqueId :String

A unique identifier for the broker, used to identify the broker in log messages, etc.

Type:
  • String
Source:

Methods

(static) parse(brokerUrl) → {Broker}

Returns a broker instance corresponding to the specified broker URL of the form: [ssl://]<hostname>[:port].

Valid URLs include:

  • ssl://mybroker:8883
  • ssl://mybroker
  • mybroker:8883
  • mybroker
Parameters:
Name Type Description
brokerUrl String

A valid broker URL.

Source:
Throws:

If the brokerUrl is not properly formatted.

Type
MalformedBrokerError
Returns:

A broker corresponding to the specified broker URL.

Type
Broker