POST
Socket handshake ticket

Overview

Mints a short-lived, one-shot ticket the client uses to authenticate the WebSocket handshake. The pattern exists because Socket.IO does not carry an Authorization header reliably and passing a JWT in the query string leaks it into access logs. Flow:
  1. The authenticated client calls this endpoint over REST and receives { ticket: "..." }.
  2. The client connects to the WebSocket with ?ticket=<ticket> in the handshake URL.
  3. The realtime server atomically GETDELs the ticket from Redis — exactly one admission per ticket.
The ticket is a 256-bit base64url-encoded random string. It expires after 60 seconds and can be redeemed at most once.

Authentication

Bearer <accessToken> required. Scope: user.

Path parameters

None.

Query parameters

None.

Request body

None.

Response — 200 OK

Example response

Error responses

Example error — 503

Side effects

  • Writes a key socket:ticket:<ticket> to Redis with the user id as the value and a 60-second TTL.
  • The key is deleted atomically by the realtime server when the socket connects (GETDEL). After 60 seconds Redis evicts it automatically.

See also

  • Authentication — full token lifecycle, including socket handshake.
  • Login — issues the access token used here.

curl