On this page

# Naeural

### new Naeural(options, logger)

The network client constructor.

Parameters:

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

Source
  - client.js, line 139

## Extends

- EventEmitter2

## Classes

Naeural

## Members

### (private) alertedNodes :AlertedNodes

Dictionary of all alerted nodes.

Type:

- AlertedNodes

Source
  - client.js, line 289

### bootOptions :Object

The boot options.

Type:

- Object

Source
  - client.js, line 157

### instanceCallbacks :*

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

Type:

- *

Source
  - client.js, line 296

### (private) logger :Logger

Reference to the logger to use.

Type:

- Logger

Source
  - client.js, line 250

### memoryUsageStats :*

Statistics about the memory used by the SDK.

Type:

- *

Source
  - client.js, line 265

### (private) mqttClient :MqttClient

The network connection.

Type:

- MqttClient

Source
  - client.js, line 242

### (private) naeuralBC :NaeuralBC

Internal reference to the Blockchain Engine

Type:

- NaeuralBC

Source
  - client.js, line 215

### (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 223

### schemas :SchemasRepository

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

Type:

- SchemasRepository

Source
  - client.js, line 234

### state :State|null

The state to update.

Type:

- State | null

Source
  - client.js, line 207

### (private) threads :Object

Internal dictionary keeping references to child threads.

Type:

- Object

Source
  - client.js, line 196

### (private) topicPaths :Object

Dictionary describing the network topics to listen to.

Type:

- Object

Source
  - client.js, line 146

### (private) universeAddresses :*

A dictionary with network addresses associated to node names.

Type:

- *

Source
  - client.js, line 258

## Methods

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

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

Parameters:

Name | Type | Description
--- | --- | ---
`address` | string |

Source
  - client.js, line 1141

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 449

Returns:

Type:
  *

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

Internal method for processing messages received from the worker threads.

Source
  - client.js, line 488

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 627

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 399

Returns:

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

### deregisterEdgeNode(node) → {void}

TODO: async Method for deregistering a network node without rebooting the client.

Parameters:

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

Source
  - client.js, line 802

Returns:

Type:
  void

### getBlockChainAddress() → {string}

This method returns the NaeuralEdgeProtocol Network unique blockchain address.

Source
  - client.js, line 755

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 892

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 831

Returns:

The Fleet Status

Type:
  Promise.<Array.<NodeStatus>>

### getMemoryStats() → {Object}

Returns the snapshot of the memory usage.

Source
  - client.js, line 730

Returns:

Type:
  Object

### getName() → {string}

This method returns the initiator name used for the connection.

Source
  - client.js, line 742

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 842

Returns:

Type:
  Promise.<Object>

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

Returns a `NodeManager` for a specific node/address.

Parameters:

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

Source
  - client.js, line 997

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 918

Returns:

Type:
  SchemaDefinition | null

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

Returns a list of all the registered DCT Schemas.

Source
  - client.js, line 860

Returns:

Type:
  Array.<AvailableDCTResponse>

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

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

Source
  - client.js, line 901

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 944

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 851

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 987

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 412

### 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 1015

Returns:

Type:
  Promise.<unknown>

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

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 875

Returns:

Type:
  Naeural

### registerEdgeNode(node) → {void}

TODO: async 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 771

Returns:

Type:
  void

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

Associates a schema with a plugin `signature`.

Parameters:

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

Source
  - client.js, line 929

Returns:

Type:
  Naeural

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

Sets a custom callback for a specific instance.

Parameters:

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

Source
  - client.js, line 956

Returns:

Type:
  Naeural

Type anything to view search result