On this page

# ZxAIClient

### new ZxAIClient(options, logger)

The network client constructor.

Parameters:

Name | Type | Default | Description
--- | --- | --- | ---
`options` | ZxAIClientOptions |  |
`logger` | * | null |

Source
  - client.js, line 136

## Extends

- EventEmitter2

## Classes

ZxAIClient

## Members

### (private) alertedNodes :AlertedNodes

Dictionary of all alerted nodes.

Type:

- AlertedNodes

Source
  - client.js, line 286

### bootOptions :Object

The boot options.

Type:

- Object

Source
  - client.js, line 154

### instanceCallbacks :*

Dictionary of instance callbacks, indexed by NEN name and instance id.

Type:

- *

Source
  - client.js, line 293

### (private) logger :Logger

Reference to the logger to use.

Type:

- Logger

Source
  - client.js, line 247

### memoryUsageStats :*

Statistics about the memory used by the SDK.

Type:

- *

Source
  - client.js, line 262

### (private) mqttClient :MqttClient

The network connection.

Type:

- MqttClient

Source
  - client.js, line 239

### (private) networkStreams :Object.<string, Observable>

Internal dictionary keeping references to the streams of events received from the child threads.

Type:

- Object.<string, Observable>

Source
  - client.js, line 220

### schemas :SchemasRepository

The repository of schemas to be used when interacting with instances and pipelines.

Type:

- SchemasRepository

Source
  - client.js, line 231

### state :State|null

The state to update.

Type:

- State | null

Source
  - client.js, line 204

### (private) threads :Object

Internal dictionary keeping references to child threads.

Type:

- Object

Source
  - client.js, line 193

### (private) topicPaths :Object

Dictionary describing the network topics to listen to.

Type:

- Object

Source
  - client.js, line 143

### (private) universeAddresses :*

A dictionary with network addresses associated to node names.

Type:

- *

Source
  - client.js, line 255

### (private) zxAIbc :ZxAIBC

Internal reference to the Blockchain Engine

Type:

- ZxAIBC

Source
  - client.js, line 212

## Methods

### (async, private) _checkNode(node) → {Promise.<boolean>}

Private method for checking if a specified node is in the controlled fleet or if it's heartbeat has been witnessed.

Parameters:

Name | Type | Description
--- | --- | ---
`node` | string |

Source
  - client.js, line 1071

Returns:

Type:
  Promise.<boolean>

### (private) _onStateMessage(messageType) → {*}

Factory method for attaching callbacks on state messages.

Parameters:

Name | Type | Description
--- | --- | ---
`messageType` | string |

Source
  - client.js, line 436

Returns:

Type:
  *

### (private) _onThreadMessage() → {*}

Internal method for processing messages received from the worker threads.

Source
  - client.js, line 464

Returns:

Type:
  *

### boot() → {void}

This method connects the client to the network and spawns all the threads on the network streams.

Source
  - client.js, line 593

Returns:

Type:
  void

### (private) checkBootComplete() → {FlatArray.<Array.<Object>, 1>}

Internal method for compiling the boot status for the subordinated worker threads.

Source
  - client.js, line 392

Returns:

Type:
  FlatArray.<Array.<Object>, 1>

### deregisterEdgeNode(node) → {void}

Method for deregistering a network node without rebooting the client.

Parameters:

Name | Type | Description
--- | --- | ---
`node` | string | The node to register.

Source
  - client.js, line 753

Returns:

Type:
  void

### getBlockChainAddress() → {string}

This method returns the NaeuralEdgeProtocol Network unique blockchain address.

Source
  - client.js, line 721

Returns:

NaeuralEdgeProtocol Network address

Type:
  string

### getDCTSchema(dctName) → {SchemaDefinition|null}

Returns the schema associated to a DCT name.

Parameters:

Name | Type | Description
--- | --- | ---
`dctName` | string |

Source
  - client.js, line 831

Returns:

Type:
  SchemaDefinition | null

### (async) getFleet() → {Promise.<Array.<NodeStatus>>}

Method for retrieving the status of the fleet of network nodes that are processed by this instance.

Source
  - client.js, line 770

Returns:

The Fleet Status

Type:
  Promise.<Array.<NodeStatus>>

### getMemoryStats() → {Object}

Returns the snapshot of the memory usage.

Source
  - client.js, line 696

Returns:

Type:
  Object

### getName() → {string}

This method returns the initiator name used for the connection.

Source
  - client.js, line 708

Returns:

initiator name

Type:
  string

### (async) getNetworkStatus(supervisor) → {Promise.<Object>}

Returns the current network status as seen by the specified supervisor. If `supervisor` is null, it returns the latest information received.

Parameters:

Name | Type | Default | Description
--- | --- | --- | ---
`supervisor` |  | null |

Source
  - client.js, line 781

Returns:

Type:
  Promise.<Object>

### (async) getNodeManager(node) → {Promise.<(NodeManager|null)>}

Returns a `NodeManager` for a specific node.

Parameters:

Name | Type | Description
--- | --- | ---
`node` |  |

Source
  - client.js, line 934

Returns:

Type:
  Promise.<(NodeManager|null)>

### getPluginSchema(signature) → {SchemaDefinition|null}

Returns the loaded schema for a specific plugin `signature`.

Parameters:

Name | Type | Description
--- | --- | ---
`signature` |  |

Source
  - client.js, line 857

Returns:

Type:
  SchemaDefinition | null

### getRegisteredDCTTypes() → {Array.<AvailableDCTResponse>}

Returns a list of all the registered DCT Schemas.

Source
  - client.js, line 799

Returns:

Type:
  Array.<AvailableDCTResponse>

### getRegisteredPluginTypes() → {Array.<AvailableSchemaResponse>}

Returns the list of Plugin Schemas associated to this network client.

Source
  - client.js, line 840

Returns:

Type:
  Array.<AvailableSchemaResponse>

### getStream(stream) → {Observable|null}

Returns a specific stream of events in the network. It can offer a window inside all the messages published in a specific message type category.

Parameters:

Name | Type | Description
--- | --- | ---
`stream` |  |

Source
  - client.js, line 883

Returns:

a subscribable stream with the selected event type.

Type:
  Observable | null

### (async) getSupervisors() → {Promise.<Array.<string>>}

Get the list of network supervisors.

Source
  - client.js, line 790

Returns:

Type:
  Promise.<Array.<string>>

### (async) getUniverse() → {Promise.<ObservedNodes>}

Returns the client's observable universe: all the hosts that sent a heartbeat that are outside this client's fleet.

Source
  - client.js, line 924

Returns:

Type:
  Promise.<ObservedNodes>

### (private) markThreadStatus(message)

Internal method for keeping track of worker threads statuses.

Parameters:

Name | Type | Description
--- | --- | ---
`message` |  |

Source
  - client.js, line 405

### publish(node, message, extraWatches) → {Promise.<unknown>}

Method for publishing a message for an NaeuralEdgeProtocol Node.

Parameters:

Name | Type | Description
--- | --- | ---
`node` | string |
`message` | Object |
`extraWatches` | Array.<Array.<string>> |

Source
  - client.js, line 950

Returns:

Type:
  Promise.<unknown>

### registerDCTType(name, schema) → {ZxAIClient}

Allows for hot registration of a new DCT Schema to be used by the network client.

Parameters:

Name | Type | Description
--- | --- | ---
`name` | string |
`schema` | SchemaDefinition |

Source
  - client.js, line 814

Returns:

Type:
  ZxAIClient

### registerEdgeNode(node) → {void}

Method for registering a new network node without rebooting the client.

Parameters:

Name | Type | Description
--- | --- | ---
`node` | string | The node to register.

Source
  - client.js, line 736

Returns:

Type:
  void

### registerPluginSchema(signature, schema) → {ZxAIClient}

Associates a schema with a plugin `signature`.

Parameters:

Name | Type | Description
--- | --- | ---
`signature` | string |
`schema` | Object |

Source
  - client.js, line 868

Returns:

Type:
  ZxAIClient

### setInstanceCallback(node, instance, callback) → {ZxAIClient}

Sets a custom callback for a specific instance.

Parameters:

Name | Type | Description
--- | --- | ---
`node` | string |
`instance` | PluginInstance | string |
`callback` |  |

Source
  - client.js, line 895

Returns:

Type:
  ZxAIClient

Type anything to view search result