struct

JSON::RPC::Request(T)

Inherits Struct < Value < Object

A single JSON-RPC 2.0 request object.

T is the type of the params member; it can be any JSON-serializable value (a NamedTuple, Hash, Array, JSON::Any, …) or Nil to omit params entirely. When id is nil the request is a notification and the peer must not send a response.

Constructors

new(method : String, params : T, id : Int64 | Nil = nil)
Source

Instance methods

id

The request identifier. Omitted (making this a notification) when nil.

Source
jsonrpc

The JSON-RPC protocol version. Always "2.0" for this library.

Source
method

The name of the method to invoke.

Source
params

The method parameters. Omitted from the wire format when nil.

Source
to_json(json : JSON::Builder) : Nil

Serializes the request, omitting params when it is nil and omitting id for notifications, as required by the specification.

Source