aboutsummaryrefslogtreecommitdiffstats
path: root/doc/src/manual/cowboy_handler.terminate.asciidoc
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2016-12-23 15:33:21 +0100
committerLoïc Hoguin <[email protected]>2016-12-23 15:33:21 +0100
commitb13c07932dfe76dfee29a0c5ce1166423faee77d (patch)
tree6aa315896ac054f16126532e4ba5de1b9982eedb /doc/src/manual/cowboy_handler.terminate.asciidoc
parent98ae01b599fcaa91f0f66ca1218cdf6c3e28d3c4 (diff)
downloadcowboy-b13c07932dfe76dfee29a0c5ce1166423faee77d.tar.gz
cowboy-b13c07932dfe76dfee29a0c5ce1166423faee77d.tar.bz2
cowboy-b13c07932dfe76dfee29a0c5ce1166423faee77d.zip
Update the cowboy_handler manual
Also fixes a small mistake in cowboy_websocket.
Diffstat (limited to 'doc/src/manual/cowboy_handler.terminate.asciidoc')
-rw-r--r--doc/src/manual/cowboy_handler.terminate.asciidoc64
1 files changed, 64 insertions, 0 deletions
diff --git a/doc/src/manual/cowboy_handler.terminate.asciidoc b/doc/src/manual/cowboy_handler.terminate.asciidoc
new file mode 100644
index 0000000..f10d945
--- /dev/null
+++ b/doc/src/manual/cowboy_handler.terminate.asciidoc
@@ -0,0 +1,64 @@
+= cowboy_handler:terminate(3)
+
+== Name
+
+cowboy_handler:terminate - Terminate the handler
+
+== Description
+
+[source,erlang]
+----
+terminate(Reason, Req | undefined, State, Handler) -> ok
+
+Reason :: any()
+Req :: cowboy_req:req()
+State :: any()
+Handler :: module()
+----
+
+Call the optional terminate callback if it is defined.
+
+Make sure to use this function at the end of the execution
+of modules that implement custom handler behaviors.
+
+== Arguments
+
+Reason::
+
+Reason for termination.
+
+Req::
+
+The Req object.
++
+It is possible to pass `undefined` if the handler has no concept
+of requests/responses and discarded the Req object before calling
+this function.
+
+State::
+
+Handler state.
+
+Handler::
+
+Handler module.
+
+== Return value
+
+The atom `ok` is always returned. It can be safely ignored.
+
+== Changelog
+
+* *2.0*: Function introduced.
+
+== Examples
+
+.Terminate a handler normally
+[source,erlang]
+----
+cowboy_handler:terminate(normal, Req, State, Handler).
+----
+
+== See also
+
+link:man:cowboy_handler(3)[cowboy_handler(3)]