diff options
Diffstat (limited to 'doc/src/manual')
-rw-r--r-- | doc/src/manual/cowboy_rest.asciidoc | 9 | ||||
-rw-r--r-- | doc/src/manual/cowboy_websocket.asciidoc | 38 |
2 files changed, 38 insertions, 9 deletions
diff --git a/doc/src/manual/cowboy_rest.asciidoc b/doc/src/manual/cowboy_rest.asciidoc index fcef799..4fbffd2 100644 --- a/doc/src/manual/cowboy_rest.asciidoc +++ b/doc/src/manual/cowboy_rest.asciidoc @@ -483,7 +483,7 @@ req() :: #{ ---- last_modified(Req, State) -> {Result, Req, State} -Result :: calendar:datetime() +Result :: calendar:datetime() | undefined Default - no last modified value ---- @@ -493,6 +493,10 @@ This date will be used to test against the if-modified-since and if-unmodified-since headers, and sent as the last-modified header in the response to GET and HEAD requests. +When `undefined` is returned, no last-modified header is +added to response. Can be useful if you save timestamp on store +action in memory and lose it after restart. + === malformed_request [source,erlang] @@ -856,6 +860,9 @@ listed here, like the authorization header. == Changelog +* *2.14*: The `last_modified` callback is now type correct + when returning `undefined` to avoid responding + a last-modified header. * *2.11*: The `ranges_provided`, `range_satisfiable` and the `RangeCallback` callbacks have been added. * *2.11*: The `generate_etag` callback can now return diff --git a/doc/src/manual/cowboy_websocket.asciidoc b/doc/src/manual/cowboy_websocket.asciidoc index 319dbae..f30ffca 100644 --- a/doc/src/manual/cowboy_websocket.asciidoc +++ b/doc/src/manual/cowboy_websocket.asciidoc @@ -200,14 +200,16 @@ Cowboy does it automatically for you. [source,erlang] ---- opts() :: #{ - active_n => pos_integer(), - compress => boolean(), - deflate_opts => cow_ws:deflate_opts() - dynamic_buffer => false | {pos_integer(), pos_integer()}, - idle_timeout => timeout(), - max_frame_size => non_neg_integer() | infinity, - req_filter => fun((cowboy_req:req()) -> map()), - validate_utf8 => boolean() + active_n => pos_integer(), + compress => boolean(), + data_delivery => stream_handlers | relay, + data_delivery_flow => pos_integer(), + deflate_opts => cow_ws:deflate_opts(), + dynamic_buffer => false | {pos_integer(), pos_integer()}, + idle_timeout => timeout(), + max_frame_size => non_neg_integer() | infinity, + req_filter => fun((cowboy_req:req()) -> map()), + validate_utf8 => boolean() } ---- @@ -241,6 +243,22 @@ Whether to enable the Websocket frame compression extension. Frames will only be compressed for the clients that support this extension. +data_delivery (stream_handlers):: + +HTTP/2+ only. Determines how data will be delivered +to the Websocket session process. `stream_handlers` +is the default and makes data go through stream +handlers. `relay` is a faster method introduced in +Cowboy 2.14 and sends data directly. `relay` is +intended to become the default in Cowboy 3.0. + +data_delivery_flow (pos_integer()):: + +When the `relay` data delivery method is used, +this value may be used to decide how much the +flow control window should be for the Websocket +stream. Currently only applies to HTTP/2. + deflate_opts (#{}):: Configuration for the permessage-deflate Websocket @@ -299,6 +317,10 @@ normal circumstances if necessary. == Changelog +* *2.14*: The `data_delivery` and `data_delivery_flow` options + were added. The `relay` data delivery mechanism + provides a better way of forwarding data to + HTTP/2+ Websocket session processes. * *2.13*: The `active_n` default value was changed to `1`. * *2.13*: The `dynamic_buffer` option was added. * *2.13*: The `max_frame_size` option can now be set dynamically. |