new Client(createClientopt)
Implementation of a scarf client. Connects to a scarf Server and automatically transforms stream arguments into scarf:// links and vice-versa.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
createClient | Client~createClient | <optional> | new net.Socket() | Function returning a Duplex stream |
Extends
- EventEmitter
Methods
connect()
Passthrough function that calls the underlying Client~AbstractClient's connect() method
invoke(method, params, callbackopt) → {Promise}
Constructs a scarf message from the given arguents and handles the response
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
method | string | JSON-RPC method name | |
params | Array.<(string|array|boolean|object|number|Stream)> | Data to send the server | |
callback | Client~invokeCallback | <optional> | Handle the results returned from the server |
Returns:
- Type:
- Promise