# chat.yakka.getRealtimeTicket

> Published by [yakka.chat](https://lexicon.garden/identity/did:plc:wpjoy2orkqq5m65vq7gg7liz)

✓ This is the authoritative definition for this NSID.

## Links

- [View on Lexicon Garden](https://lexicon.garden/lexicon/did:plc:wpjoy2orkqq5m65vq7gg7liz/chat.yakka.getRealtimeTicket)
- [Documentation](https://lexicon.garden/lexicon/did:plc:wpjoy2orkqq5m65vq7gg7liz/chat.yakka.getRealtimeTicket/docs)
- [Examples](https://lexicon.garden/lexicon/did:plc:wpjoy2orkqq5m65vq7gg7liz/chat.yakka.getRealtimeTicket/examples)

## Definitions

### `chat.yakka.getRealtimeTicket`

**Type**: `procedure`

Issue a short-lived, single-use ticket for opening the realtime socket (ADR 0034 §3).

A browser cannot set headers on a WebSocket, and a cookie is the wrong instrument across origins — so the ticket goes in the socket URL, which is why it must be worth little: it authenticates one upgrade, once, within seconds. The socket is the appview's primary surface (ADR 0011), so this is not an afterthought but the only authenticated path for most of what a client does.

#### Output

**Encoding**: `application/json`

### `chat.yakka.getRealtimeTicket#output`

**Type**: `object`

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `socket` | `string` (uri) | Yes | The URL to open, ticket already appended. Handed over whole so a client is never assembling an authenticated URL itself. |
| `ticket` | `string` | Yes |  |
| `expiresAt` | `string` (datetime) | Yes |  |

## Raw Schema

```json
{
  "id": "chat.yakka.getRealtimeTicket",
  "defs": {
    "main": {
      "type": "procedure",
      "output": {
        "schema": {
          "ref": "#output",
          "type": "ref"
        },
        "encoding": "application/json"
      },
      "description": "Issue a short-lived, single-use ticket for opening the realtime socket (ADR 0034 §3).\n\nA browser cannot set headers on a WebSocket, and a cookie is the wrong instrument across origins — so the ticket goes in the socket URL, which is why it must be worth little: it authenticates one upgrade, once, within seconds. The socket is the appview's primary surface (ADR 0011), so this is not an afterthought but the only authenticated path for most of what a client does."
    },
    "output": {
      "type": "object",
      "required": [
        "ticket",
        "expiresAt",
        "socket"
      ],
      "properties": {
        "socket": {
          "type": "string",
          "format": "uri",
          "description": "The URL to open, ticket already appended. Handed over whole so a client is never assembling an authenticated URL itself."
        },
        "ticket": {
          "type": "string"
        },
        "expiresAt": {
          "type": "string",
          "format": "datetime"
        }
      }
    }
  },
  "$type": "com.atproto.lexicon.schema",
  "lexicon": 1
}
```
