diff --git a/elixir/apps/api/lib/api/endpoint.ex b/elixir/apps/api/lib/api/endpoint.ex index 0104df2cc..086fd5a1a 100644 --- a/elixir/apps/api/lib/api/endpoint.ex +++ b/elixir/apps/api/lib/api/endpoint.ex @@ -24,9 +24,9 @@ defmodule API.Endpoint do # https://hexdocs.pm/phoenix/Phoenix.Logger.html plug Plug.Telemetry, event_prefix: [:phoenix, :endpoint] - socket "/gateway", API.Gateway.Socket, API.Sockets.options() - socket "/client", API.Client.Socket, API.Sockets.options() - socket "/relay", API.Relay.Socket, API.Sockets.options() + socket "/gateway", API.Gateway.Socket, API.Sockets.options(timeout: :timer.seconds(37)) + socket "/client", API.Client.Socket, API.Sockets.options(timeout: :timer.seconds(307)) + socket "/relay", API.Relay.Socket, API.Sockets.options(timeout: :timer.seconds(41)) plug :fetch_user_agent plug API.Router diff --git a/elixir/apps/api/lib/api/sockets.ex b/elixir/apps/api/lib/api/sockets.ex index 00ec73aa9..bd9e50704 100644 --- a/elixir/apps/api/lib/api/sockets.ex +++ b/elixir/apps/api/lib/api/sockets.ex @@ -5,15 +5,18 @@ defmodule API.Sockets do """ require Logger - def options do + def options(websocket_overrides \\ []) do [ - websocket: [ - timeout: :timer.seconds(307), - transport_log: :debug, - check_origin: :conn, - connect_info: [:trace_context_headers, :user_agent, :peer_data, :x_headers], - error_handler: {__MODULE__, :handle_error, []} - ], + websocket: + Keyword.merge( + [ + transport_log: :debug, + check_origin: :conn, + connect_info: [:trace_context_headers, :user_agent, :peer_data, :x_headers], + error_handler: {__MODULE__, :handle_error, []} + ], + websocket_overrides + ), longpoll: false ] end