Extends
Methods
-
clientConnected()
-
Registers the
eventdata listener when client connects.Pushes received data into
messageBufferand calls _waitForData.- Inherited From:
- Source:
-
getResult(message)
-
Get the result for the request. Calls the function associated with the method and returns the result.
Parameters:
Name Type Description messageJSON Valid JSON-RPC message object
- Inherited From:
- Source:
Returns:
- Type
- Promise
-
gotBatchRequest(requests)
-
Attempts to get the result for all requests in the batch. Will send result to client if successful and error otherwise.
Parameters:
Name Type Description requestsArray.<JSON> Valid JSON-RPC batch request
- Inherited From:
- Source:
Returns:
- Type
- Array.<Promise>
-
gotError(error)
-
Writes error to the client. Will send a JSON-RPC error object if the passed error cannot be parsed.
Parameters:
Name Type Description errorError Errorobject instance where the message should be a JSON-RPC message object- Inherited From:
- Source:
-
gotNotification(message)
-
Calls
emiton factory with the event name beingmessage.methodand the date beingmessage.Parameters:
Name Type Description messagestring JSON-RPC message object
- Inherited From:
- Source:
-
gotRequest(message)
-
Attempts to get the result for the request object. Will send result to client if successful and will send an error otherwise.
Parameters:
Name Type Description messageJSON JSON-RPC message object
- Inherited From:
- Source:
Returns:
- Type
- Promise
-
validateMessage(message)
-
Validates if there are any issues with the incoming request
Parameters:
Name Type Description messageJSON Valid JSON-RPC request object
- Inherited From:
- Source:
Throws:
Will throw an error for any of the below reasons
Reason Type message is not an object Invalid Request the server does not have the required method Method Not Found the params are not an array or object Invalid Params the "jsonrpc" property was passed for a v1 server Invalid Request -
validateRequest(chunk)
-
Validate the request message
Parameters:
Name Type Description chunkstring - Inherited From:
- Source:
Throws:
Will throw an error with a JSON-RPC error object if chunk cannot be parsed
Returns:
- Type
- JSON
-
writeToClient(message)
-
Send message to the client
Parameters:
Name Type Description messagestring Stringified JSON-RPC message object
- Inherited From:
- Source: