Polling and Notification (see UCAR reference)
Client makes a request, e.g. "GET /some/resource"
Branch:
- Server requires asynchronous, responds with 4xx
- Server doesn't require asynchronous, blocks, and proceeds as normal.
Client makes a request, e.g. "GET /some/resource" and accepts asynchronous response with HTTP headers:
- Accept-Asynchronous: polling
- Accept-Asynchronous: notify; Asynchronous-end-point: http://some-webhooks-uri/
- Accept-Asynchronous: response; Asynchronous-end-point: http://some-webhooks-uri/
If the server decides not to send an asynchronous response, blocks and proceeds as normal.
If the server wants to send an asynchronous response, server responses with status 202 (ACCEPTED).
If the client sends "Accept-Asynchronous: polling", the server will provide a URL for the client to poll for request status. When done processing, the server will send a 301 to the request body.
If the client sends "Accept-Asynchronous: notify", when the server is done processing, the server will send a webhooks-style POST request to the provided endpoint with metadata about the response (response size, what request generated it, etc)
If the client sends "Accept-Asynchronous: response", when the server is done processing, the server will POST the generated response body to the provided endpoint.
Client makes a request:
GET /some/object/fcr:content Accept-Asynchronous: polling |
Server sends a 202 (Accepted) response with a location for the client to poll for status
HTTP/1.0 202 Location: /fcr:status/123456789 |
Client polls location for status
GET /fcr:status/123456789 |
Server should send a useful status response, in a serialization TBD. When done processing, server should send a redirect to the result.
HTTP/1.0 301 Location: /fcr:status/123456789/fcr:content Expires: (+24 hours?) |
Client can pick up the response:
GET /fcr:status/123456789/fcr:content |
The server MAY cache the content response (if appropriate) for some length of time. The server MAY also expose the cached response at the original request endpoint (e.g. /some/object/fcr:content could response immediately instead of requiring asynchronous interactions)
TODO
TODO