Creates an instance of Server
.
Information about the JSON-RPC server schema.
Private
infoPrivate
methodsAdds a method to the server.
If the handler
parameter is not a function.
If a method with the same name already exists.
If the method name starts with "rpc.", which is reserved.
The schema of the method.
The handler function for the method.
Private
createPrivate
Creates a JSON-RPC error response object.
A JSON-RPC error response object.
The JSON-RPC request object (optional).
The error code.
The error message.
Optional
data: objectAdditional error data (optional).
Private
createPrivate
Creates a JSON-RPC response object.
A JSON-RPC response object.
The JSON-RPC request object.
The result of the request.
Executes a JSON-RPC request string and returns the corresponding response object(s).
A promise that resolves with the corresponding JSON-RPC response object(s) (if any).
If an error occurs while executing the request.
The JSON-RPC request string.
Private
findPrivate
Finds a method with a given name.
The method with the given name or null
if it doesn't exist.
The name of the method.
Returns the server schema.
The server schema.
Private
handlePrivate
Handles a single JSON-RPC request object
A promise that resolves to the corresponding JSON-RPC response object, or void
if the request is a notification.
If the handler function throws a custom error.
If the request is invalid or there's an error while processing the request.
The JSON-RPC request object to handle.
Private
methodPrivate
parsePrivate
Parses a JSON-RPC request string and returns the corresponding request object(s).
The corresponding JSON-RPC request object(s).
If the request string cannot be parsed.
The JSON-RPC request string.
Private
validatePrivate
Validates a JSON-RPC request object against its corresponding method schema.
true
if the request is valid, false
otherwise.
If the request is invalid.
The JSON-RPC request object to validate.
Generated using TypeDoc
JSON-RPC server implementation.