ExpectsResponse

Standard Request Object which expects a reply.

Properties

Link copied to clipboard
abstract val method: String

A String containing the name of the method to be invoked. Method names that begin with the word rpc followed by a period character (U+002E or ASCII 46) are reserved for rpc-internal methods and extensions and MUST NOT be used for anything else.

Link copied to clipboard
abstract val params: JsonElement?

A Structured value that holds the parameter values to be used during the invocation of the method. This member MAY be omitted.

Link copied to clipboard
abstract val requestId: String

An identifier established by the Client that MUST contain a String, Number, or NULL value if included. The value SHOULD normally not be Null and Numbers SHOULD NOT contain fractional parts. The Server MUST reply with the same value in the Response object if included. This member is used to correlate the context between the two objects.

Functions

Link copied to clipboard
abstract suspend fun replyWithInvalidParams()

Replies with JsonRpcException.InvalidParams. Could be thought of as a 400 in the HTTP World

Link copied to clipboard
abstract suspend fun replyWithMethodNotFound()

Replies with JsonRpcException.MethodNotFound. Could be thought of as a 404 in the HTTP World

Link copied to clipboard
abstract suspend fun replyWithResult(result: JsonElement)

Replies with the result. Could be thought of as a 200 in the HTTP World

Link copied to clipboard
abstract suspend fun replyWithServerError(code: Int, message: String, data: JsonElement? = null)

Replies with JsonRpcException.ServerError. Could be thought of as a 500 in the HTTP World