WebSocket config

Public, non-sensitive connection settings for Laravel Echo / Reverb. Clients fetch this on startup and cache it, so rotating the key or moving the WS host needs no app release. Paths are relative to the /api/v1 prefix; this endpoint is public.

See Common errors. The returned auth_endpoint authorizes private/presence channels and requires Authorization: Bearer {token}.

Endpoints

Method URI Role Description
GET /ws-config Public Reverb/Echo connection settings

In production this route is throttled to 30 requests / minute; outside production it is unthrottled. The app secret is never exposed.


GET /ws-config

Returns the values Laravel Echo needs to open a Reverb connection.

Response 200

{
  "key": "app-key",
  "ws_host": "ws.aguita.app",
  "ws_port": 443,
  "wss_port": 443,
  "scheme": "https",
  "force_tls": true,
  "auth_endpoint": "https://api.aguita.app/api/v1/broadcasting/auth"
}

force_tls is true whenever scheme is https. Use auth_endpoint as Echo's authEndpoint for private/presence channel authorization.


Examples

# Fetch the WS config (public)
curl /api/v1/ws-config
// Laravel Echo (Reverb)
import Echo from "laravel-echo";
import Pusher from "pusher-js";

const cfg = await fetch("/api/v1/ws-config").then((r) => r.json());

window.Echo = new Echo({
  broadcaster: "reverb",
  key: cfg.key,
  wsHost: cfg.ws_host,
  wsPort: cfg.ws_port,
  wssPort: cfg.wss_port,
  forceTLS: cfg.force_tls,
  enabledTransports: ["ws", "wss"],
  authEndpoint: cfg.auth_endpoint,
  auth: { headers: { Authorization: `Bearer ${token}` } },
});