ElectrumCluster

ElectrumCluster

High-level electrum client that provides transparent load balancing, confidence checking and/or low-latency polling.

Constructor

new ElectrumCluster(application, version, confidence, distribution, order, timeout, pingInterval, reconnectInterval, useBigInt)

Deprecated:
  • Yes
Parameters:
Name Type Description
application string your application name, used to identify to the electrum hosts.
version string protocol version to use with the hosts.
confidence number wait for this number of hosts to provide identical results.
distribution number request information from this number of hosts.
order ClusterOrder select hosts to communicate with in this order.
timeout number how long network delays we will wait for before taking action, in milliseconds.
pingInterval number the time between sending pings to the electrum host, in milliseconds.
reconnectInterval number the time between reconnection attempts to the electrum host, in milliseconds.
useBigInt boolean whether to use bigint for numbers in json response.

Classes

ElectrumCluster

Methods

(async) addServer(host, port, scheme, autoConnect)

Description:
  • Adds a server to the cluster.
Deprecated:
  • Yes
Parameters:
Name Type Default Description
host string fully qualified domain name or IP number of the host.
port number the TCP network port of the host.
scheme TransportScheme the transport scheme to use for connection
autoConnect boolean true flag indicating whether the server should automatically connect (default true)
Throws:
if the cluster's version is not a valid version string.
Type
Error
Returns:
a promise that resolves when the connection has been initiated.

(async) addServer(host, port, scheme, autoConnect)

Description:
  • Adds a server to the cluster.
Deprecated:
  • Yes
Parameters:
Name Type Description
host string fully qualified domain name or IP number of the host.
port number the TCP network port of the host.
scheme TransportScheme the transport scheme to use for connection
autoConnect boolean flag indicating whether the server should automatically connect (default true)
Throws:
if the cluster's version is not a valid version string.
Type
Error
Returns:
a promise that resolves when the connection has been initiated.

(async) dismissSubscriptionNotification()

Description:
  • Forgets/Removes notification data for a specific notification. This is required in order to allow future identical notifications to be properly processed and emitted.
Deprecated:
  • Yes

(async) dismissSubscriptionNotification(responseDataIdentifier) → {Promise.<void>}

Description:
  • Forgets/Removes notification data for a specific notification. This is required in order to allow future identical notifications to be properly processed and emitted.
Deprecated:
  • Yes
Parameters:
Name Type Description
responseDataIdentifier
Returns:
Type
Promise.<void>

(async) ready()

Description:
  • Provides a method to check or wait for the cluster to become ready.
Deprecated:
  • Yes
Returns:
a promise that resolves when the required servers are available.

(async) ready()

Description:
  • Provides a method to check or wait for the cluster to become ready.
Deprecated:
  • Yes
Returns:
a promise that resolves when the required servers are available.

(async) request(method, …parameters)

Description:
  • Calls a method on the remote server with the supplied parameters.
Deprecated:
  • Yes
Parameters:
Name Type Attributes Description
method string name of the method to call.
parameters string <repeatable>
one or more parameters for the method.
Throws:
  • if not enough clients are connected
    Type
    Error
  • if no response is received with sufficient integrity
    Type
    Error
Returns:
a promise that resolves with the result of the method.

(async) request(method, …parameters)

Description:
  • Calls a method on the remote server with the supplied parameters.
Deprecated:
  • Yes
Parameters:
Name Type Attributes Description
method string name of the method to call.
parameters string <repeatable>
one or more parameters for the method.
Throws:
  • if not enough clients are connected
    Type
    Error
  • if no response is received with sufficient integrity
    Type
    Error
Returns:
a promise that resolves with the result of the method.

(async) shutdown(retainSubscriptions)

Description:
  • Disconnects all servers from the cluster. Removes all event listeners and handlers from all underlying clients and connections. This includes all active subscriptions, unless retainSubscriptions is set to true.
Deprecated:
  • Yes
Parameters:
Name Type Default Description
retainSubscriptions boolean false retain subscription data so they will be restored on reconnection.
Returns:
a list with the disconnection result for every client

(async) shutdown(retainSubscriptions)

Description:
  • Disconnects all servers from the cluster. Removes all event listeners and handlers from all underlying clients and connections. This includes all active subscriptions, unless retainSubscriptions is set to true.
Deprecated:
  • Yes
Parameters:
Name Type Description
retainSubscriptions boolean retain subscription data so they will be restored on reconnection.
Returns:
a list with the disconnection result for every client

(async) startup()

Description:
  • Connects all servers from the cluster and attaches event listeners and handlers for all underlying clients and connections.
Deprecated:
  • Yes
Throws:
if the cluster's version is not a valid version string.
Type
Error

(async) startup() → {Promise.<Array>}

Description:
  • Connects all servers from the cluster and attaches event listeners and handlers for all underlying clients and connections.
Deprecated:
  • Yes
Throws:
if the cluster's version is not a valid version string.
Type
Error
Returns:
Type
Promise.<Array>

(async) subscribe(method, …parameters)

Description:
  • Subscribes to the method at the cluster and attaches the callback function to the event feed.
Deprecated:
  • Yes
Parameters:
Name Type Attributes Description
method string one of the subscribable methods the server supports.
parameters string <repeatable>
one or more parameters for the method.
Throws:
  • if not enough clients are connected
    Type
    Error
  • if no response is received with sufficient integrity for the initial request
    Type
    Error

(async) subscribe(method, …parameters) → {Promise.<void>}

Description:
  • Subscribes to the method at the cluster and attaches the callback function to the event feed.
Deprecated:
  • Yes
Parameters:
Name Type Attributes Description
method string one of the subscribable methods the server supports.
parameters string <repeatable>
one or more parameters for the method.
Throws:
  • if not enough clients are connected
    Type
    Error
  • if no response is received with sufficient integrity for the initial request
    Type
    Error
Returns:
Type
Promise.<void>

(async) unsubscribe(method, …parameters)

Description:
  • Unsubscribes to the method at the cluster and removes any callback functions when there are no more subscriptions for the method.
Deprecated:
  • Yes
Parameters:
Name Type Attributes Description
method string one of the subscribable methods the server supports.
parameters string <repeatable>
one or more parameters for the method.
Throws:
if, for any of the clients, no subscriptions exist for the combination of the provided `method` and `parameters.
Type
Error

(async) unsubscribe(method, …parameters) → {Promise.<void>}

Description:
  • Unsubscribes to the method at the cluster and removes any callback functions when there are no more subscriptions for the method.
Deprecated:
  • Yes
Parameters:
Name Type Attributes Description
method string one of the subscribable methods the server supports.
parameters string <repeatable>
one or more parameters for the method.
Throws:
if, for any of the clients, no subscriptions exist for the combination of the provided `method` and `parameters.
Type
Error
Returns:
Type
Promise.<void>

Events

degraded

Description:
  • Triggers when the cluster loses a connection and can no longer satisfy the cluster distribution policy.
Deprecated:
  • Yes

disabled

Description:
  • Triggers when the cluster loses a connection and can no longer satisfy the cluster confidence policy.
Deprecated:
  • Yes

notification

Description:
  • Triggers when the cluster verifies the integrity of remote server sent data that is not a request responses.
Deprecated:
  • Yes

ready

Description:
  • Triggers when the cluster connects to enough servers to satisfy both the cluster confidence and distribution policies.
Deprecated:
  • Yes