opengeospatial / ogcapi-common

OGC API - Common provides those elements shared by most or all of the OGC API standards to ensure consistency across the family.
https://ogcapi.ogc.org/common
Other
45 stars 14 forks source link

Handling 'cancel' requests #325

Open ghobona opened 1 year ago

ghobona commented 1 year ago

During the 2022 Web Mapping Code Sprint there was a demonstration by @IvanSanchez of a map being moved and the client application sending 'cancel' requests to the server as the map was being moved. The client application was sending 'cancel' requests as the map was being moved. This is a useful capability because it notifies the server that the request that it is trying to fulfil is no longer needed and is being canceled.

The context was OGC API - Maps, however it might be that support for 'cancel' requests is relevant to other OGC API Standards.

Should OGC API - Maps support cancel operations?

If so, what should such a capability look like?

IvanSanchez commented 1 year ago

On the technical side (and AFAIK), a "cancel" operation will look like a premature TCP disconnect.

In other words: At the very least, a server can be sure that a client is no longer interested in response data if the client has closed the underlying TCP connection.

Now: this can happen willingly (a web browser changing the src of an <img> before the previous image was fully transferred) or unwillingly (a computer disconnecting from the network, or a network failure)

jerstlouis commented 1 year ago

In our client we have implemented support for canceling requests for tiles no longer into view. As far as I know, the specification dosn't really need to say anything about this, it is part of the HTTP specification (EDIT: Actually it is a TCP Reset, not HTTP). But it is good to bring awareness of this.

joanma747 commented 1 year ago

Informative: How to do it in modern browsers

https://stackoverflow.com/questions/31061838/how-do-i-cancel-an-http-fetch-request

https://medium.com/swlh/making-cancel-able-http-requests-with-javascript-fetch-api-f934bba18228#:~:text=We%20can%20use%20the%20AbortController%20object%20and%20the%20associated%20AbortSignal,the%20HTTP%20request%20is%20done.

Informative: How to do it in web assembly

https://emscripten.org/docs/api_reference/emscripten.h.html#c.emscripten_async_wget2_abort -- for Emscripten / WebAsssembly

We decided that we could move it to OGC API common and recommend to add this to the OGC API common user guide.