From 8910e103ce32ccc593e748a2c83d18831c90f915 Mon Sep 17 00:00:00 2001 From: lain Date: Wed, 2 Jan 2019 11:39:11 +0100 Subject: [PATCH] Add handler for Phoenix-style socket. --- config/config.exs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/config/config.exs b/config/config.exs index 90e3a4aec..7fad1138f 100644 --- a/config/config.exs +++ b/config/config.exs @@ -54,6 +54,17 @@ config :pleroma, :uri_schemes, "xmpp" ] +websocket_config = [ + path: "/websocket", + serializer: [ + {Phoenix.Socket.V1.JSONSerializer, "~> 1.0.0"}, + {Phoenix.Socket.V2.JSONSerializer, "~> 2.0.0"} + ], + timeout: 60_000, + transport_log: false, + compress: false +] + # Configures the endpoint config :pleroma, Pleroma.Web.Endpoint, url: [host: "localhost"], @@ -62,6 +73,8 @@ config :pleroma, Pleroma.Web.Endpoint, {:_, [ {"/api/v1/streaming", Elixir.Pleroma.Web.MastodonAPI.WebsocketHandler, []}, + {"/socket/websocket", Phoenix.Endpoint.CowboyWebSocket, + {nil, {Pleroma.Web.Endpoint, Pleroma.Web.UserSocket, websocket_config}}}, {:_, Plug.Adapters.Cowboy.Handler, {Pleroma.Web.Endpoint, []}} ]} ] -- 2.45.2