Connections

Active connections, user management, and room broadcasting API

Connections API

Manage active WebSocket connections, users, and room operations.

Admin session required: All connection management endpoints require an authenticated admin session, the session_token cookie of a user with the admin role. A valid non-admin session receives 403. These are operator-only administrative operations.

Get Active Connections

Authentication Required

List all active WebSocket connections in the system. Rate-limited to 30 requests per minute.

Endpoint: GET /api/connections/active

curl -X GET "$BASE_URL/api/connections/active" \
  -b cookies.txt

Response:

[
  {
    "id": "client_550e8400",
    "clientId": "client_550e8400",
    "userId": "user_123",
    "roomId": "ABC123",
    "presenterName": "John Doe",
    "isHost": true,
    "joinedAt": "2024-01-15T10:30:00Z",
    "connectionStatus": "connected"
  }
]

Kick User

Authentication Required

Forcefully disconnect a user from the system. Rate-limited to 30 requests per minute.

Endpoint: POST /api/connections/{id}/kick

ParameterTypeRequiredDescription
idpathYesClient ID to disconnect
curl -X POST "$BASE_URL/api/connections/client_550e8400/kick" \
  -b cookies.txt

Response:

{
  "success": true,
  "message": "Client disconnected"
}

Broadcast to Room

Authentication Required

Send a message to all clients in a room. Rate-limited to 30 requests per minute.

Endpoint: POST /api/connections/rooms/{roomId}/broadcast

ParameterTypeRequiredDescription
roomIdpathYesRoom ID to broadcast to
messagebodyYesMessage content
curl -X POST "$BASE_URL/api/connections/rooms/ABC123/broadcast" \
  -b cookies.txt \
  -H "Content-Type: application/json" \
  -d '{"message":"Session ending in 5 minutes"}'

Response:

{
  "success": true,
  "message": "Message broadcast to 5 clients"
}

Close Room

Authentication Required

Close a room and disconnect all clients. Rate-limited to 5 requests per minute.

Endpoint: POST /api/connections/rooms/{roomId}/close

ParameterTypeRequiredDescription
roomIdpathYesRoom ID to close
curl -X POST "$BASE_URL/api/connections/rooms/ABC123/close" \
  -b cookies.txt

Response:

{
  "success": true,
  "message": "Room ABC123 closed, 5 clients disconnected"
}

Admin Operations Flow

Rate Limits

EndpointRequests / 60sTier
/api/connections/active30Standard
/api/connections/{id}/kick30Standard
/api/connections/rooms/{roomId}/broadcast30Standard
/api/connections/rooms/{roomId}/close5Strict
Limits are enforced per IP over a fixed 60-second window; exceeding one returns 429 until the window resets. There is no progressive block duration.