From 5f421f93bc36d73161f7aa8705da5ea3a3793807 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Sun, 28 May 2017 19:04:16 +0200 Subject: Introduce the req_filter Websocket option This option allows customizing the compacting of the Req object when using Websocket. By default it will keep most public fields excluding headers of course, since those can be large. --- doc/src/manual/cowboy_websocket.asciidoc | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'doc/src') diff --git a/doc/src/manual/cowboy_websocket.asciidoc b/doc/src/manual/cowboy_websocket.asciidoc index b728edf..7979b97 100644 --- a/doc/src/manual/cowboy_websocket.asciidoc +++ b/doc/src/manual/cowboy_websocket.asciidoc @@ -134,7 +134,8 @@ timeout:: ---- opts() :: #{ compress => boolean(), - idle_timeout => timeout() + idle_timeout => timeout(), + req_filter => fun((cowboy_req:req()) -> map()) } ---- @@ -162,6 +163,13 @@ idle_timeout (60000):: connection open without receiving anything from the client. +req_filter:: + A function applied to the Req to compact it and + only keep required information. The Req is only + given back in the `terminate/3` callback. By default + it keeps the method, version, URI components and peer + information. + == Changelog * *2.0*: The Req object is no longer passed to Websocket callbacks. -- cgit v1.2.3