mirror of
https://github.com/warmbly/warmbly.git
synced 2026-08-19 00:01:14 +00:00
ce870a15b3
- realtime/: `mix format` applied; long Logger calls reformatted across config/runtime/application/connections/user_channel/user_socket/ endpoint. CI's "Check formatting" step now passes. - CI Elixir bumped from 1.16 → 1.18 (with OTP 27) to match mix.exs's `~> 1.18` requirement. Phoenix 1.8.7 + plug 1.19 also expect this. - web/: generate + commit pnpm-lock.yaml so actions/setup-node@v4's pnpm cache step + `pnpm install --frozen-lockfile` can resolve.
35 lines
852 B
Elixir
35 lines
852 B
Elixir
defmodule RealtimeWeb.Endpoint do
|
|
@moduledoc """
|
|
Phoenix Endpoint for WebSocket connections only.
|
|
|
|
This service is a pure WebSocket gateway - no HTTP endpoints.
|
|
All HTTP traffic should be handled by the Go backend.
|
|
"""
|
|
|
|
use Phoenix.Endpoint, otp_app: :realtime
|
|
|
|
socket("/socket", RealtimeWeb.UserSocket,
|
|
websocket: [
|
|
timeout: 60_000,
|
|
compress: true,
|
|
check_origin: false
|
|
],
|
|
longpoll: false
|
|
)
|
|
|
|
# Minimal plugs for WebSocket upgrade handling
|
|
plug(Plug.RequestId)
|
|
plug(Plug.Telemetry, event_prefix: [:realtime, :endpoint])
|
|
|
|
# Health check endpoint for Docker/load balancer probes
|
|
plug(:health_check)
|
|
|
|
defp health_check(%Plug.Conn{request_path: "/health"} = conn, _opts) do
|
|
conn
|
|
|> Plug.Conn.send_resp(200, "ok")
|
|
|> Plug.Conn.halt()
|
|
end
|
|
|
|
defp health_check(conn, _opts), do: conn
|
|
end
|