new Discoverer(name, client [, mspid])
Construct a Discoverer object with the name.
Parameters:
Name | Type | Argument | Description |
---|---|---|---|
name |
string | The name of this peer | |
client |
Client | The client instance | |
mspid |
string |
<optional> |
The mspid (organization) of this peer |
Returns:
The Discoverer instance.
- Type
- Discoverer
Extends
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 - Inherited From:
- Overrides:
-
<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. - Inherited From:
- Overrides:
-
disconnect()
-
disconnect the service connection.
- Inherited From:
- Overrides:
-
isConnectable()
-
Check that this ServiceEndpoint could be connected, even if it has failed a previous attempt.
- Inherited From:
- Overrides:
-
isTLS()
-
Determine whether or not this remote endpoint uses TLS.
- Inherited From:
- Overrides:
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
- Inherited From:
- Overrides:
-
sendDiscovery(signedEnvelope, timeout)
-
Send an discovery request to this peer. Proposal
Parameters:
Name Type Description signedEnvelope
timeout
Number A number indicating milliseconds to wait on the response before rejecting the promise with a timeout error. This overrides the default timeout of the Peer instance and the global timeout in the config settings. Returns:
A Promise for a DiscoveryResponse- Type
- Promise
-
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. - Inherited From:
- Overrides:
-
toString()
-
return a printable representation of this object
- Inherited From:
- Overrides: