Heartbeat
Registers a new host or refreshes an existing host’s TTL. This endpoint serves dual purposes:- Initial Registration: When a host first starts, it sends its details to become available for matchmaking
- Keep-Alive: Ongoing heartbeats refresh the 30-second TTL to prevent expiration
Request Body
Unique identifier for this host session. Generate a UUID when the host application starts.Example:
"550e8400-e29b-41d4-a716-446655440000"Room identifier used for WebRTC signaling. This is passed to clients for peer connection establishment.Example:
"room-abc123xyz"Geographic region code for this host. Used for client-side region filtering.Supported values:
us-east-1, us-west-1, eu-central, localCurrent availability status of the host.
idle- Ready to accept new connectionsbusy- Currently in an active session
idle for new registrations.Request Example
Response
Indicates whether the heartbeat was successfully processed.
Time-to-live in seconds before the host entry expires. Always returns
30.Response Example
Implementation Notes
- Send heartbeats every 20-25 seconds to maintain a safety buffer before the 30-second TTL expires
- If the host crashes or loses connectivity, the Redis entry automatically expires
- The same endpoint handles both initial registration and subsequent heartbeats
- Store your
hostIdandroomIdin memory - they should remain constant for the host’s lifetime
Update Status
Call this endpoint immediately when a client connects to mark yourself as busy.
- A peer successfully connects via WebRTC signaling (set to
busy) - A session ends and the host becomes available again (set to
idle)
Request Body
The unique identifier for your host session. Must match the
hostId used in heartbeat requests.Example: "550e8400-e29b-41d4-a716-446655440000"The new status for this host.
idle- Host is available for new matchesbusy- Host is currently serving a client
Request Example
Response
Indicates whether the status update was successful.
Response Example
Typical Flow
- Host starts: Send heartbeat with
status: "idle" - Client connects: Call
/api/host/statuswithstatus: "busy" - Continue heartbeats: Keep sending heartbeats (status persists)
- Session ends: Call
/api/host/statuswithstatus: "idle" - Host shuts down: Stop sending heartbeats (entry expires automatically)