Add Sec-WebSocket-Protocol
to response header
This commit is contained in:
parent
8b39d6f93c
commit
5bd0717de2
@ -35,6 +35,13 @@ def init(%{qs: qs} = req, state) do
|
||||
{_, stream} <- List.keyfind(params, "stream", 0),
|
||||
{:ok, user} <- allow_request(stream, [access_token, sec_websocket]),
|
||||
topic when is_binary(topic) <- expand_topic(stream, params) do
|
||||
req =
|
||||
if sec_websocket != nil do
|
||||
:cowboy_req.set_resp_header("sec-websocket-protocol", sec_websocket, req)
|
||||
else
|
||||
req
|
||||
end
|
||||
|
||||
{:cowboy_websocket, req, %{user: user, topic: topic}, %{idle_timeout: @timeout}}
|
||||
else
|
||||
{:error, code} ->
|
||||
|
Loading…
Reference in New Issue
Block a user