Wub Suspend

Wub is near HTTP/1.1 and so it permits responses to be generated out of order while guaranteeing to deliver them in order.

Requests are received by a per-connection reader coroutine and passed to a per-connection consumer coroutine, responses are sent back to the reader coroutine, and then scheduled for transmission back to the client.

The consumer (the [Httpd do] command) may signal to the reader that it has no response to the latest received request by returning a simple dict {-suspend $N} where N is the number of milliseconds grace it requires. This grace period protects the connection from reaping for that time period. As short-hand, the consumer may return {}, which will suspend the response for twice the connection timeout period.

The consumer may receive, and is expected to process, further requests from the client while it's in this grace period, but those responses will only be returned to the client when the suspended response has been sent.

The consumer, when its response is ready, simply calls [Httpd send $r] with $r being its suspended response. This delivers the response to the reader coroutine, which delivers it, and any other pending responses which had been blocked by its suspension, to the client.

Note: the resumed response must be sent from the consumer coroutine, so if there's an external event which generates the eventual response, it must be injected into the consumer coroutine. This can be done by recording the [info coroutine] value from within the consumer, and using it to send a dict which is distinguishable from an HTTP request reception event.