JsonRpc::DocumentStream
Streams JSON documents from and into an IO stream.
Uses a new-line ("\n") when sending. Doesn't require it when receiving.
Constants
BUFFER_SIZE = 1024
Size of the read buffer
DEFAULT_MAX_SIZE = 1024 ** 2
Maximum document size (1 MiB)
Constructors
Instance methods
Reads a single document from the stream.
A document begins with a opening brace, and ends with a balancing closing one.
Note: The result may not be valid JSON. The algorithm only tries to find the end of a valid JSON document: If it's not valid, the result may be neither.
ameba:disable Metrics/CyclomaticComplexity