class

JsonRpc::StreamClient

Inherits JsonRpc::Stream / JsonRpc::Client / Reference / Object

Implements JSON-RPC over a persistant data stream.

Constants

SIZE_LIMIT = (2 * 1024) * 1024

Constructors

new(stream : JsonRpc::DocumentStream, remote_address : String, run = true)

Creates a streaming client from stream. If run is true, the client will start accepting messages right away. If you choose to pass false, then make sure to call #run some time afterwards manually, even if you're only calling remote methods.

Source

Instance methods

close

Closes the stream.

Source
inspect(io)
Source
read_loop

Runs the read-loop in the current fiber, blocking it. See #run.

Source
read_once

Waits for exactly one document to arrive and processes it.

Source
remote_address

The remote address

Source
request_size_limit

Maximum request size limit. If a client exceeds this, it will be disconnected. Defaults to SIZE_LIMIT

Source
request_size_limit=(request_size_limit : Int32)

Maximum request size limit. If a client exceeds this, it will be disconnected. Defaults to SIZE_LIMIT

Source
run

Starts the read-loop in a background fiber. Make sure to only call this method once, and only if you passed false for run to the constructor.

If you did not do anything fancy, don't call this method.

Source
send_message(_id, message_data)

Interface for JsonRpc::Client

Source
stream
Source