> ## Documentation Index
> Fetch the complete documentation index at: https://docs.staging.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`](https://docs.staging.relayapp.im/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](https://docs.staging.relayapp.im/api-reference/errors.md#1005), [2001](https://docs.staging.relayapp.im/api-reference/errors.md#2001), [2003](https://docs.staging.relayapp.im/api-reference/errors.md#2003), [2004](https://docs.staging.relayapp.im/api-reference/errors.md#2004), [3006](https://docs.staging.relayapp.im/api-reference/errors.md#3006).

## Next steps

* [API overview](https://docs.staging.relayapp.im/api-reference/overview.md)
* [Error codes](https://docs.staging.relayapp.im/api-reference/errors.md)
* [Receive events](https://docs.staging.relayapp.im/events.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.