aboutsummaryrefslogtreecommitdiffstats
path: root/doc/src/manual/cowboy_http2.asciidoc
blob: 517879fb666653f3cf2751b4af9faf44e10fefee (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
= cowboy_http2(3)

== Name

cowboy_http2 - HTTP/2

== Description

The module `cowboy_http2` implements HTTP/2
as a Ranch protocol.

== Options

// @todo Might be worth moving cowboy_clear/tls/stream_h options
// to their respective manual, when they are added.

[source,erlang]
----
opts() :: #{
    connection_type    => worker | supervisor,
    env                => cowboy_middleware:env(),
    inactivity_timeout => timeout(),
    middlewares        => [module()],
    preface_timeout    => timeout(),
    shutdown_timeout   => timeout(),
    stream_handlers    => [module()]
}
----

Configuration for the HTTP/2 protocol.

This configuration is passed to Cowboy when starting listeners
using `cowboy:start_clear/3` or `cowboy:start_tls/3` functions.

It can be updated without restarting listeners using the
Ranch functions `ranch:get_protocol_options/1` and
`ranch:set_protocol_options/2`.

The default value is given next to the option name:

connection_type (supervisor)::
    Whether the connection process also acts as a supervisor.

env (#{})::
    Middleware environment.

inactivity_timeout (300000)::
    Time in ms with nothing received at all before Cowboy closes the connection.

middlewares ([cowboy_router, cowboy_handler])::
    Middlewares to run for every request.

preface_timeout (5000)::
    Time in ms Cowboy is willing to wait for the connection preface.

shutdown_timeout (5000)::
    Time in ms Cowboy will wait for child processes to shut down before killing them.

stream_handlers ([cowboy_stream_h])::
    Ordered list of stream handlers that will handle all stream events.

== Changelog

* *2.0*: Protocol introduced.

== See also

link:man:cowboy(7)[cowboy(7)],
link:man:cowboy_http(3)[cowboy_http(3)],
link:man:cowboy_websocket(3)[cowboy_websocket(3)]