aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--manual/cowboy_websocket.md6
-rw-r--r--src/cowboy_websocket.erl6
2 files changed, 9 insertions, 3 deletions
diff --git a/manual/cowboy_websocket.md b/manual/cowboy_websocket.md
index ae3ca1b..1b07107 100644
--- a/manual/cowboy_websocket.md
+++ b/manual/cowboy_websocket.md
@@ -28,6 +28,12 @@ Meta values
>
> The version of the Websocket protocol being used.
+### websocket_compress
+
+> Type: true | false
+>
+> Whether a websocket compression extension in in use.
+
Exports
-------
diff --git a/src/cowboy_websocket.erl b/src/cowboy_websocket.erl
index 073d7c6..6e86b90 100644
--- a/src/cowboy_websocket.erl
+++ b/src/cowboy_websocket.erl
@@ -121,12 +121,12 @@ websocket_extensions(State, Req) ->
deflate_frame = true,
inflate_state = Inflate,
deflate_state = Deflate
- }, Req2};
+ }, cowboy_req:set_meta(websocket_compress, true, Req2)};
_ ->
- {ok, State, Req2}
+ {ok, State, cowboy_req:set_meta(websocket_compress, false, Req2)}
end;
_ ->
- {ok, State, Req}
+ {ok, State, cowboy_req:set_meta(websocket_compress, false, Req)}
end.
-spec handler_init(#state{}, Req)