summaryrefslogtreecommitdiffstats
path: root/docs/en/cowboy/2.0/guide/ws_handlers.asciidoc
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2017-02-22 13:26:18 +0100
committerLoïc Hoguin <[email protected]>2017-02-22 13:26:18 +0100
commitade8a523dd6afe21f169a3f41cd78cc1ba730c74 (patch)
tree15ebf7938b8374b2f867be361bc52c34b3415ef6 /docs/en/cowboy/2.0/guide/ws_handlers.asciidoc
parent7bb98d0476dbe4ee5e9317e42ca17e4a7d717e0d (diff)
downloadninenines.eu-ade8a523dd6afe21f169a3f41cd78cc1ba730c74.tar.gz
ninenines.eu-ade8a523dd6afe21f169a3f41cd78cc1ba730c74.tar.bz2
ninenines.eu-ade8a523dd6afe21f169a3f41cd78cc1ba730c74.zip
Update docs
Diffstat (limited to 'docs/en/cowboy/2.0/guide/ws_handlers.asciidoc')
-rw-r--r--docs/en/cowboy/2.0/guide/ws_handlers.asciidoc9
1 files changed, 5 insertions, 4 deletions
diff --git a/docs/en/cowboy/2.0/guide/ws_handlers.asciidoc b/docs/en/cowboy/2.0/guide/ws_handlers.asciidoc
index 011aa314..2c38b87b 100644
--- a/docs/en/cowboy/2.0/guide/ws_handlers.asciidoc
+++ b/docs/en/cowboy/2.0/guide/ws_handlers.asciidoc
@@ -60,13 +60,13 @@ be:
init(Req, State) ->
case cowboy_req:parse_header(<<"sec-websocket-protocol">>, Req) of
undefined ->
- {ok, Req, State};
+ {cowboy_websocket, Req, State};
Subprotocols ->
case lists:keymember(<<"mqtt">>, 1, Subprotocols) of
true ->
Req2 = cowboy_req:set_resp_header(<<"sec-websocket-protocol">>,
<<"mqtt">>, Req),
- {ok, Req2, State};
+ {cowboy_websocket, Req2, State};
false ->
{stop, Req, State}
end
@@ -210,12 +210,13 @@ than needed.
The `init/2` callback can set the timeout to be used
for the connection. For example, this would make Cowboy
-close connections idle for more than 60 seconds:
+close connections idle for more than 30 seconds:
[source,erlang]
----
init(Req, State) ->
- {cowboy_websocket, Req, State, 60000}.
+ {cowboy_websocket, Req, State, #{
+ idle_timeout => 30000}}.
----
This value cannot be changed once it is set. It defaults to