Skip to main content

Module stdio

Module stdio 

Source
Expand description

The stdio transport: one JSON message per line in, one per line out. Nothing but protocol messages is ever written to the output; diagnostics go through tracing, which the executable points at stderr. EOF on input ends the session cleanly, and so does a closed output, because both mean the client has gone.

The loop does not know what answers a message: a local Server, or a bridge to the shared server of another process, is a function from a message to an optional response, and the loop drives whichever it is given.

Constants§

MAX_LINE_BYTES
The longest message a client may send on one line: the bound a request body has over HTTP, so that both transports refuse the same message (I2147).

Functions§

serve
Serve until the input ends, answering every message through handle. Returns the number of messages answered.