> ## Documentation Index
> Fetch the complete documentation index at: https://docs.relayapp.im/llms.txt
> Use this file to discover all available pages before exploring further.

# WebSocket

> Receive events through an authenticated WebSocket connection.

Receive events through an authenticated WebSocket connection.

## The WebSocket object

The `ready` frame describes the connection and its event window.

| Field                   | Type           | Description            |
| ----------------------- | -------------- | ---------------------- |
| `type`                  | string         | Type.                  |
| `connection_id`         | string         | Connection id.         |
| `acked_through`         | string         | Acked through.         |
| `full_sync_required`    | boolean        | Full sync required.    |
| `full_sync_through`     | string or null | Full sync through.     |
| `heartbeat_interval_ms` | integer        | Heartbeat interval ms. |
| `max_in_flight`         | integer        | Max in flight.         |

## Example

`GET /v1/websocket` upgrades the connection (HTTP `101`). Every frame after that is one of these:

| Frame                | Fields                                          |
| -------------------- | ----------------------------------------------- |
| `event`              | `type`, `sequence`, `event`                     |
| `ack`                | `type`, `through_sequence`                      |
| `ping`               | `type`, `sent_at`                               |
| `full_sync`          | `type`, `through_sequence`, `reason`            |
| `full_sync_complete` | `type`, `through_sequence`                      |
| `error`              | `type`, `code`, `message`, `fatal`, `retryable` |
| `disconnect`         | `type`, `reason`                                |

## Operations

| Method | Path                                                                   | What it does               |
| ------ | ---------------------------------------------------------------------- | -------------------------- |
| `GET`  | [`/v1/websocket`](/api-reference/websocket/connect-an-agent-websocket) | Connect an Agent WebSocket |

## Errors

Common authentication, validation, and server errors apply alongside resource errors. Read `error.message` for the rejected condition.

[1005](/api-reference/errors#1005), [2001](/api-reference/errors#2001), [2003](/api-reference/errors#2003), [2004](/api-reference/errors#2004), [3006](/api-reference/errors#3006).

## Next steps

* [API overview](/api-reference/overview)
* [Error codes](/api-reference/errors)
* [Receive events](/events)
