Part 12 of 14 · 1 min read
Quick notes
- A transport never changes what a message means. It only decides framing, request metadata, cancellation and shutdown. A server written once runs over stdio or HTTP unchanged.
- stdout belongs to the protocol. A stray
printcorrupts the frame; logs go to stderr, and shutdown follows an order: close stdin, wait, terminate, kill. - A mirrored header is only as trustworthy as the server's own check of the body. HeaderMismatch (-32020) is what stops a gateway's decision from being spoofed underneath it.
- A dropped connection after the work is done needs a key, not a retry. Read-only calls are always safe to retry; writes need an idempotency key or a refusal that names what to check.
Originvalidation stops a browser, not a program. Bind to loopback and authenticate as well. After any reconnect, re-read what you cache, because nothing replays what you missed.