Stage 1 of 5v1 · ba1b6c9f
Speak JSON-RPC
Process line-delimited ping requests and preserve their identifiers.
One message per line
Your server is a persistent process. Read stdin line by line, parse every non-empty line as a JSON object, and write exactly one compact response per request.
At this stage accept {"jsonrpc":"2.0","id":1,"method":"ping"} and answer {"jsonrpc":"2.0","id":1,"result":{}}. Preserve the id without turning numbers into strings. Do not print diagnostics to stdout.
Keep transport, method dispatch, and response construction separate. You will reuse all three later.
Acceptance criteria
- Process every message until EOF.
pingreturns an empty result.- Each response ends in a newline and contains no extra spaces.