scarf~ Client

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:
NameTypeAttributesDefaultDescription
createClientClient~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:
NameTypeAttributesDescription
methodstring

JSON-RPC method name

paramsArray.<(string|array|boolean|object|number|Stream)>

Data to send the server

callbackClient~invokeCallback<optional>

Handle the results returned from the server

Returns:
Type: 
Promise