Class: ServiceEndpoint

ServiceEndpoint

The ServiceEndpoint class represents a the base class for all Service nodes (Endorser, Committer, Discoverer, and Eventer).

new ServiceEndpoint()

Methods


<async> checkConnection( [reset])

Check the connection status
Parameters:
Name Type Argument Default Description
reset boolean <optional>
true Optional, attempt to reconnect if endpoint is not connected

<async> connect( [endpoint] [, options])

Connects this ServiceEndpoint with the given url and opts. If a connect exist an error will be thrown. The application must disconnect the connection before re-connecting to the service.
Parameters:
Name Type Argument Description
endpoint Endpoint <optional>
Service connection options including the url. When an endpoint is not provided, the setEndpoint() must have been called previously. If setEndpoint was previously call and a endpoint is provided here then it will replace the existing endpoint.
options ConnectionOptions <optional>
Any specific options for this instance of the connection to the peer. These will override options from the endpoint service connection options. Endpoint options and option provided here will replace options from the setEndpoint() if previously called.

disconnect()

disconnect the service connection.

isConnectable()

Check that this ServiceEndpoint could be connected, even if it has failed a previous attempt.

isTLS()

Determine whether or not this remote endpoint uses TLS.
Throws:
if the Service Endpoint has not been connected to an endpoint.
Type
Error
Returns:
True if this endpoint uses TLS, false otherwise.
Type
boolean

<async> resetConnection()

Reset the connection

setEndpoint(endpoint, options)

Use this method to give this service endpoint an endpoint and options that it may connect to at a later time. Use the ServiceEndpoint#connect method without a endpoint or options to connect using the setting provided here.
Parameters:
Name Type Description
endpoint Endpoint Service connection options including the url.
options ConnectionOptions Any specific options for this instance of the connection to the peer. These will override options from the endpoint service connection options.

toString()

return a printable representation of this object