aboutsummaryrefslogtreecommitdiffstats
path: root/doc/src/manual/cowboy_req.cast.asciidoc
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2019-10-07 13:25:49 +0200
committerLoïc Hoguin <[email protected]>2019-10-07 13:25:49 +0200
commit2e8fcb9a9ef9ef9beff25ed4d48cf0d90609a69b (patch)
tree96193a4e156389d67172cde5894d70a5e0395d91 /doc/src/manual/cowboy_req.cast.asciidoc
parent5cdf78fd570a5239a83e8dce3705e53a08c47f7e (diff)
downloadcowboy-2e8fcb9a9ef9ef9beff25ed4d48cf0d90609a69b.tar.gz
cowboy-2e8fcb9a9ef9ef9beff25ed4d48cf0d90609a69b.tar.bz2
cowboy-2e8fcb9a9ef9ef9beff25ed4d48cf0d90609a69b.zip
Add cowboy_req:cast/2
Better than sending messages manually.
Diffstat (limited to 'doc/src/manual/cowboy_req.cast.asciidoc')
-rw-r--r--doc/src/manual/cowboy_req.cast.asciidoc64
1 files changed, 64 insertions, 0 deletions
diff --git a/doc/src/manual/cowboy_req.cast.asciidoc b/doc/src/manual/cowboy_req.cast.asciidoc
new file mode 100644
index 0000000..d6e018f
--- /dev/null
+++ b/doc/src/manual/cowboy_req.cast.asciidoc
@@ -0,0 +1,64 @@
+= cowboy_req:cast(3)
+
+== Name
+
+cowboy_req:cast - Cast a stream handler event
+
+== Description
+
+[source,erlang]
+----
+cast(Event :: any(), Req :: cowboy_req:req()) -> ok
+----
+
+Cast a stream handler event.
+
+The event will be passed to stream handlers through the
+`info/3` callback.
+
+== Arguments
+
+Event::
+
+The event to be sent to stream handlers.
+
+Req::
+
+The Req object.
+
+== Return value
+
+The atom `ok` is always returned. It can be safely ignored.
+
+== Changelog
+
+* *2.7*: Function introduced.
+
+== Examples
+
+.Increase the HTTP/1.1 idle timeout
+[source,erlang]
+----
+cowboy_req:cast({set_options, #{
+ idle_timeout => 3600000
+}}, Req).
+----
+
+.Add user data to metrics
+----
+cowboy_req:cast({set_options, #{
+ metrics_user_data => #{handler => ?MODULE}
+}}, Req).
+----
+
+.Enable compression buffering
+----
+cowboy_req:cast({set_options, #{
+ compress_buffering => true
+}}, Req).
+----
+
+== See also
+
+link:man:cowboy_req(3)[cowboy_req(3)],
+link:man:cowboy_stream(3)[cowboy_stream(3)]