commit: ffee478ed0298f2cf29d4d51ed28105119552496
parent 4dc2d4bf7b39ca427fdb9be90a9789b7c4d9824e
Author: Mark Felder <feld@feld.me>
Date: Wed, 31 May 2023 15:30:58 -0400
Move websocket config for Shoutbox to the Endpoint
This is the modern way of configuring it
Diffstat:
2 files changed, 14 insertions(+), 15 deletions(-)
diff --git a/config/config.exs b/config/config.exs
@@ -110,17 +110,6 @@ 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"],
@@ -130,9 +119,6 @@ config :pleroma, Pleroma.Web.Endpoint,
{:_,
[
{"/api/v1/streaming", Pleroma.Web.MastodonAPI.WebsocketHandler, []},
- {"/websocket", Phoenix.Endpoint.CowboyWebSocket,
- {Phoenix.Transports.WebSocket,
- {Pleroma.Web.Endpoint, Pleroma.Web.UserSocket, websocket_config}}},
{:_, Plug.Cowboy.Handler, {Pleroma.Web.Endpoint, []}}
]}
]
diff --git a/lib/pleroma/web/endpoint.ex b/lib/pleroma/web/endpoint.ex
@@ -9,7 +9,20 @@ defmodule Pleroma.Web.Endpoint do
alias Pleroma.Config
- socket("/socket", Pleroma.Web.UserSocket)
+ socket("/socket", Pleroma.Web.UserSocket,
+ websocket: [
+ 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
+ ],
+ longpoll: false
+ )
+
socket("/live", Phoenix.LiveView.Socket)
plug(Plug.Telemetry, event_prefix: [:phoenix, :endpoint])