Version 1 of Wub Suspend

Updated 2009-01-13 08:04:48 by CMcC

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.

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, to the client.


enter categories here