aboutsummaryrefslogtreecommitdiffstats
path: root/src/cowboy_websocket.erl
diff options
context:
space:
mode:
Diffstat (limited to 'src/cowboy_websocket.erl')
-rw-r--r--src/cowboy_websocket.erl9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/cowboy_websocket.erl b/src/cowboy_websocket.erl
index b460745..a94a5ce 100644
--- a/src/cowboy_websocket.erl
+++ b/src/cowboy_websocket.erl
@@ -34,6 +34,7 @@
-type commands() :: [cow_ws:frame()
| {active, boolean()}
| {deflate, boolean()}
+ | {set_options, map()}
].
-export_type([commands/0]).
@@ -527,6 +528,14 @@ commands([{active, Active}|Tail], State, Data) when is_boolean(Active) ->
commands(Tail, State#state{active=Active}, Data);
commands([{deflate, Deflate}|Tail], State, Data) when is_boolean(Deflate) ->
commands(Tail, State#state{deflate=Deflate}, Data);
+commands([{set_options, SetOpts}|Tail], State0=#state{opts=Opts}, Data) ->
+ State = case SetOpts of
+ #{idle_timeout := IdleTimeout} ->
+ loop_timeout(State0#state{opts=Opts#{idle_timeout => IdleTimeout}});
+ _ ->
+ State0
+ end,
+ commands(Tail, State, Data);
commands([Frame|Tail], State, Data0) ->
Data = [frame(Frame, State)|Data0],
case is_close_frame(Frame) of