aboutsummaryrefslogtreecommitdiff
path: root/lib/pleroma/web/mastodon_api/websocket_handler.ex
diff options
context:
space:
mode:
authorEgor Kislitsyn <egor@kislitsyn.com>2019-10-21 14:19:15 +0700
committerEgor Kislitsyn <egor@kislitsyn.com>2019-10-21 14:19:15 +0700
commit4ea1a61b008c932bc83fcd6cd07bb7f4c251204a (patch)
treec763bd3a2a21ee3e40384ee323076bbb577b7ccb /lib/pleroma/web/mastodon_api/websocket_handler.ex
parent8ad015ef64e0d2a4cd9f2979ff08d28be3a635e5 (diff)
parent62e3d76a450c1b34ba8d0c88a184ec861ed90f29 (diff)
downloadpleroma-4ea1a61b008c932bc83fcd6cd07bb7f4c251204a.tar.gz
Merge branch 'develop' into refactor/following-relationships
Diffstat (limited to 'lib/pleroma/web/mastodon_api/websocket_handler.ex')
-rw-r--r--lib/pleroma/web/mastodon_api/websocket_handler.ex7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/pleroma/web/mastodon_api/websocket_handler.ex b/lib/pleroma/web/mastodon_api/websocket_handler.ex
index 3c26eb406..a400d1c8d 100644
--- a/lib/pleroma/web/mastodon_api/websocket_handler.ex
+++ b/lib/pleroma/web/mastodon_api/websocket_handler.ex
@@ -35,6 +35,13 @@ defmodule Pleroma.Web.MastodonAPI.WebsocketHandler 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 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} ->