Merge branch 'fix-chat' into 'develop'
authorrinpatch <rinpatch@sdf.org>
Thu, 3 Jan 2019 08:59:05 +0000 (08:59 +0000)
committerrinpatch <rinpatch@sdf.org>
Thu, 3 Jan 2019 08:59:05 +0000 (08:59 +0000)
Add handler for Phoenix-style socket.

See merge request pleroma/pleroma!619

config/config.exs

index d743406dc898c5b4b02e24197adc26b4e23190a5..11ee220e737b2054f04f733059164fdee6558e41 100644 (file)
@@ -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, []}}
        ]}
     ]