0
Fork 0
mirror of https://github.com/ninenines/cowboy.git synced 2025-07-14 12:20:24 +00:00

Add new stream handlers to the guide

Also link from the guide to manual pages.
This commit is contained in:
Loïc Hoguin 2019-10-07 14:06:37 +02:00
parent 80aef3cdaa
commit b350180503
No known key found for this signature in database
GPG key ID: 8A9DF795F6FED764

View file

@ -17,7 +17,8 @@ in Cowboy.
=== Stream handlers === Stream handlers
Stream handlers must implement five different callbacks. link:man:cowboy_stream(3)[Stream handlers]
must implement five different callbacks.
Four of them are directly related; one is special. Four of them are directly related; one is special.
All callbacks receives the stream ID as first argument. All callbacks receives the stream ID as first argument.
@ -55,11 +56,20 @@ modified.
Cowboy comes with two handlers. Cowboy comes with two handlers.
`cowboy_stream_h` is the default stream handler. link:man:cowboy_stream_h(3)[cowboy_stream_h] is the default
It is the core of much of the functionality of Cowboy. stream handler. It is the core of much of the functionality
All chains of stream handlers should call it last. of Cowboy. All chains of stream handlers should call it last.
`cowboy_compress_h` will automatically compress link:man:cowboy_compress_h(3)[cowboy_compress_h] will
responses when possible. It is not enabled by default. automatically compress responses when possible. It is not
It is a good example for writing your own handlers enabled by default. It is a good example for writing your
that will modify responses. own handlers that will modify responses.
link:man:cowboy_metrics_h(3)[cowboy_metrics_h] gathers
metrics about a stream then passes them to a configurable
function. It is not enabled by default.
link:man:cowboy_tracer_h(3)[cowboy_tracer_h] can be used to
conditionally trace streams based on the contents of the
request or its origin. Trace events are passed to a
configurable function. It is not enabled by default.