Crate nimiq_jsonrpc_server

Source
Expand description

This crate implements a JSON-RPC HTTP server using warp. It accepts POST requests at / and requests over websocket at /ws.

Structs§

AllowListDispatcher
Dispatcher that only allows specified methods.
Config
The server configuration
Cors
CORS configuration
Credentials
Basic auth credentials, containing username and password.
CredentialsVerificationError
Invalid username or password was passed to Credentials::verify.
ModularDispatcher
A dispatcher, that can be composed from other dispatchers.
Notify
Notifies a single task to wake up.
Server
A JSON-RPC server.

Enums§

Error
A server error.
Message
A WebSocket message.

Traits§

Dispatcher
A method dispatcher. These take a request and handle the method execution. Can be generated from an impl block using nimiq_jsonrpc_derive::service.

Functions§

connect_stream
Connects a stream such that its items are sent to the client as notifications.
dispatch_method_with_args
Read the request and call a handler function if possible. This variant accepts calls with arguments.
dispatch_method_without_args
Read the request and call a handler function if possible. This variant accepts calls without arguments.
error_response
Constructs an error response if necessary (i.e., if the request ID was set).
method_not_found
Returns an error response for a method that was not found. This returns None, if the request doesn’t expect a response.

Type Aliases§

ResponseAndSubScriptionNotifier
Type defining a response and a possible notify handle used to terminate a subscription stream