Class: DxlClientNode

DxlClient~DxlClientNode(nodeConfig)

Client configuration node responsible for establishing communication with the Data Exchange Layer (DXL) fabric.

Constructor

new DxlClientNode(nodeConfig)

Parameters:
Name Type Description
nodeConfig Object

Configuration data which the node uses.

Properties
Name Type Description
configFile String

Path to the DXL client configuration file. If this value is a directory, the node will attempt to load a file named dxlclient.config within the directory.

keepAliveInterval Number

The maximum period in seconds between communications with a connected broker. If no other messages are being exchanged, this controls the rate at which the client will send ping messages to the broker.

reconnectDelay Number

The delay between connection retry attempts in seconds.

Source:

Members

connected :boolean

Whether or not the client is currently connected to the DXL fabric.

Type:
  • boolean
Source:

dxlClient :external:DxlClient

Handle to the underlying DXL client object

Type:
Source:

Methods

addEventCallback(topic, eventCallback)

Adds an event callback to the client for the specified topic. The callback will be invoked when DxlClient messages are received by the client on the specified topic.

Parameters:
Name Type Description
topic String

Topic to receive DxlClient messages on. An empty string or null value indicates that the callback should receive messages for all topics (no filtering).

eventCallback function

Callback function which should be invoked for a matching message. The first argument passed to the callback function is the Event object.

Source:

asyncRequest(request, responseCallbackopt)

Sends a Request message to a remote DXL service asynchronously. An optional response callback can be specified. This callback will be invoked when the corresponding Response message is received by the client.

Parameters:
Name Type Attributes Description
request external:Request

The request message to send to a remote DXL service.

responseCallback function <optional>

An optional response callback that will be invoked when the corresponding Response message is received by the client.

Source:
Throws:

If no prior attempt has been made to connect the client. This could occur if no prior call has been made to registerUserNode.

Type
external:DxlError

registerServiceAsync(serviceType, callbacksByTopic) → {external:ServiceRegistrationInfo}

Registers a DXL service with the fabric asynchronously.

Parameters:
Name Type Description
serviceType String

A textual name for the service. For example, '/mycompany/myservice'.

callbacksByTopic Object

Object containing a set of topics for the service to respond to along with their associated request callback instances. Each key in the object should have a string representation of the topic name. Each corresponding value in the object should contain the function to be invoked when a Request message is received. The Request object is supplied as the only parameter to the request callback function.

Source:
Returns:

An object containing information for the registered service. This value should be supplied in the corresponding call to unregisterServiceAsync. when the service should be unregistered.

Type
external:ServiceRegistrationInfo

registerUserNode(userNode)

Register the supplied node as a "user" of the client config node. This is used to determine when it is necessary to attempt to connect to the DXL fabric and when the client could be disconnected (when no users are remaining). The registered node's status method is called back upon in order to update the node with the current status information for the broker connection.

Parameters:
Name Type Description
userNode Object

The node to register.

Source:

removeEventCallback(topic, eventCallback)

Removes an event callback from the client for the specified topic. This method must be invoked with the same arguments as when the callback was originally registered via addEventCallback.

Parameters:
Name Type Description
topic String

The topic to remove the callback for.

eventCallback function

The event callback to be removed for the specified topic.

Source:

sendEvent(event)

Attempts to deliver the specified Event message to the DXL fabric.

Parameters:
Name Type Description
event external:Event

The external:Event to send.

Source:
Throws:

If no prior attempt has been made to connect the client. This could occur if no prior call has been made to registerUserNode.

Type
external:DxlError

sendResponse(response)

Attempts to deliver the specified Response message to the DXL fabric. The fabric will in turn attempt to deliver the response back to the client who sent the corresponding Request.

Parameters:
Name Type Description
response external:Response

The Response to send.

Source:
Throws:

If no prior attempt has been made to connect the client. This could occur if no prior call has been made to registerUserNode.

Type
external:DxlError

unregisterServiceAsync(serviceRegInfo)

Unregisters (removes) a DXL service from the fabric asynchronously. The specified ServiceRegistrationInfo instance contains information about the service that is to be removed.

Parameters:
Name Type Description
serviceRegInfo external:ServiceRegistrationInfo

A ServiceRegistrationInfo instance containing information about the service that is to be unregistered.

Source:

unregisterUserNode()

Unregister the supplied node as a "user" of the client config node. This is used to determine when it is necessary to attempt to connect to the DXL fabric and when the client could be disconnected (when no users are remaining). The registered node's status method is called back upon in order to update the node with the current status information for the broker connection.

Source: