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. |
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>
port :Number
The port of the broker
Type:
- Number
uniqueId :String
A unique identifier for the broker, used to identify the broker in log messages, etc.
Type:
- String
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. |
Throws:
-
If the brokerUrl is not properly formatted.
- Type
- MalformedBrokerError
Returns:
A broker corresponding to the specified broker URL.
- Type
- Broker