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

# Stream Comparison

> Side-by-side comparison of WebSocket, Public SSE, and Private SSE

Choose the right streaming method for your use case.

## Feature Comparison

| Feature                 | WebSocket                | Public SSE                 | Private SSE                      |
| ----------------------- | ------------------------ | -------------------------- | -------------------------------- |
| **Endpoint**            | `wss://scrape.st/ws`     | `GET /stream`              | `GET /stream?token=`             |
| **Authentication**      | `x-api-key` header       | None                       | Token (24h, via `/stream/token`) |
| **Direction**           | Bidirectional            | Server → Client            | Server → Client                  |
| **Payload**             | Full `SourceEvent`       | Truncated (100 chars)      | Full `SourceEvent`               |
| **X enriched**          | ✅                        | ❌ (fast-x only)            | ✅                                |
| **Telegram / Discord**  | ✅                        | ✅                          | ✅                                |
| **Auto-reconnect**      | ❌ (implement yourself)   | ✅ (built-in `EventSource`) | ✅ (built-in `EventSource`)       |
| **Buffer on reconnect** | ❌                        | ✅ Last 5 events            | ✅ Last 5 events                  |
| **Keepalive**           | Ping/Pong (30s interval) | `:` comment (15s interval) | `:` comment (15s interval)       |
| **Dead timeout**        | 60s                      | N/A                        | N/A                              |
| **Best for**            | Production bots, trading | Demos, public dashboards   | Production web apps              |

## When to Use What

<CardGroup cols={3}>
  <Card title="WebSocket" icon="plug">
    **Use when you need:**

    * Full payload for all sources
    * Bidirectional communication
    * Fine-grained connection control
    * Server-side Node.js / Python apps

    → [WebSocket docs](./websocket-connections)
  </Card>

  <Card title="Public SSE" icon="eye">
    **Use when you need:**

    * Quick prototype, zero setup
    * No API key at hand
    * Public monitoring dashboard
    * Browser-only (no backend)

    → [Public SSE docs](./public-sse)
  </Card>

  <Card title="Private SSE" icon="lock">
    **Use when you need:**

    * Full data in a browser app
    * Automatic reconnection
    * Token-based auth (no exposed API key)
    * Frontend `EventSource` compatibility

    → [Private SSE docs](./private-sse)
  </Card>
</CardGroup>

## Latency

All methods deliver data within milliseconds of each other:

| Method      | Typical Latency (fast-x) | Typical Latency (enriched) |
| ----------- | ------------------------ | -------------------------- |
| WebSocket   | \~50ms                   | \~200-500ms                |
| Public SSE  | \~50ms                   | N/A (not streamed)         |
| Private SSE | \~50ms                   | \~200-500ms                |

## Query Parameters (All Methods)

| Parameter           | WebSocket | Public SSE | Private SSE | Description                |
| ------------------- | --------- | ---------- | ----------- | -------------------------- |
| `useFastX`          | ✅         | ✅          | ✅           | Receive fast-x push events |
| `ignoreFullPayload` | ✅         | N/A        | ✅           | Skip enriched X payloads   |
| `token`             | N/A       | N/A        | ✅           | Authentication token       |
