Add handler for Phoenix-style socket.
authorlain <lain@soykaf.club>
Wed, 2 Jan 2019 10:39:11 +0000 (11:39 +0100)
committerlain <lain@soykaf.club>
Wed, 2 Jan 2019 10:39:11 +0000 (11:39 +0100)
config/config.exs

index 90e3a4aecd6a3d96d5d27cdf39d3a24c7e789fc9..7fad1138f4902ad286bc5f0a553e00d1f1cb88e2 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, []}}
        ]}
     ]