# games.cavu.tier-madness.subscribeGame

> Published by [chris.pardy.family](https://lexicon.garden/identity/did:plc:dp7v5b5kejmmzzpwmqyf5wj6)

✓ This is the authoritative definition for this NSID.

## Links

- [View on Lexicon Garden](https://lexicon.garden/lexicon/did:plc:dp7v5b5kejmmzzpwmqyf5wj6/games.cavu.tier-madness.subscribeGame)
- [Documentation](https://lexicon.garden/lexicon/did:plc:dp7v5b5kejmmzzpwmqyf5wj6/games.cavu.tier-madness.subscribeGame/docs)
- [Examples](https://lexicon.garden/lexicon/did:plc:dp7v5b5kejmmzzpwmqyf5wj6/games.cavu.tier-madness.subscribeGame/examples)

## Definitions

### `games.cavu.tier-madness.subscribeGame#created`

**Type**: `object`

Reply to #create: the join code to share, and what goes in the host's games.cavu.tier-madness.lobby record.

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `code` | `string` | Yes |  |
| `codeHash` | `string` | Yes |  |
| `expiresAt` | `string` (datetime) | Yes |  |
| `game` | `string` | Yes |  |
| `spaceHost` | `string` (did) | No |  |

### `games.cavu.tier-madness.subscribeGame`

**Type**: `subscription`

A game's live channel. The socket is bidirectional: the client sends games.cavu.tier-madness.clientFrame frames (#auth then #create/#join to play, or just #spectate to watch); the server sends a #snapshot of the game as that viewer may see it whenever it changes.

```json
{
  "description": "A game's live channel. The socket is bidirectional: the client sends games.cavu.tier-madness.clientFrame frames (#auth then #create/#join to play, or just #spectate to watch); the server sends a #snapshot of the game as that viewer may see it whenever it changes.",
  "errors": [
    {
      "name": "GameNotFound"
    },
    {
      "name": "AuthRequired"
    },
    {
      "name": "BadFrame"
    },
    {
      "name": "IllegalAction"
    },
    {
      "name": "RateLimited"
    },
    {
      "name": "GameStarted"
    },
    {
      "description": "Couldn't record the move in the player's PDS; it wasn't applied.",
      "name": "WriteFailed"
    }
  ],
  "message": {
    "schema": {
      "refs": [
        "#snapshot",
        "#created"
      ],
      "type": "union"
    }
  },
  "parameters": {
    "properties": {},
    "type": "params"
  },
  "type": "subscription"
}
```

### `games.cavu.tier-madness.subscribeGame#snapshot`

**Type**: `object`

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `now` | `integer` | Yes | Server time, ms since epoch. |
| `seq` | `integer` | Yes |  |
| `view` | `ref` → `games.cavu.tier-madness.defs#gameView` | Yes |  |

## Raw Schema

```json
{
  "$type": "com.atproto.lexicon.schema",
  "defs": {
    "created": {
      "description": "Reply to #create: the join code to share, and what goes in the host's games.cavu.tier-madness.lobby record.",
      "properties": {
        "code": {
          "maxLength": 4,
          "minLength": 4,
          "type": "string"
        },
        "codeHash": {
          "maxLength": 128,
          "type": "string"
        },
        "expiresAt": {
          "format": "datetime",
          "type": "string"
        },
        "game": {
          "maxLength": 64,
          "type": "string"
        },
        "spaceHost": {
          "format": "did",
          "type": "string"
        }
      },
      "required": [
        "game",
        "code",
        "codeHash",
        "expiresAt"
      ],
      "type": "object"
    },
    "main": {
      "description": "A game's live channel. The socket is bidirectional: the client sends games.cavu.tier-madness.clientFrame frames (#auth then #create/#join to play, or just #spectate to watch); the server sends a #snapshot of the game as that viewer may see it whenever it changes.",
      "errors": [
        {
          "name": "GameNotFound"
        },
        {
          "name": "AuthRequired"
        },
        {
          "name": "BadFrame"
        },
        {
          "name": "IllegalAction"
        },
        {
          "name": "RateLimited"
        },
        {
          "name": "GameStarted"
        },
        {
          "description": "Couldn't record the move in the player's PDS; it wasn't applied.",
          "name": "WriteFailed"
        }
      ],
      "message": {
        "schema": {
          "refs": [
            "#snapshot",
            "#created"
          ],
          "type": "union"
        }
      },
      "parameters": {
        "properties": {},
        "type": "params"
      },
      "type": "subscription"
    },
    "snapshot": {
      "properties": {
        "now": {
          "description": "Server time, ms since epoch.",
          "type": "integer"
        },
        "seq": {
          "minimum": 0,
          "type": "integer"
        },
        "view": {
          "ref": "games.cavu.tier-madness.defs#gameView",
          "type": "ref"
        }
      },
      "required": [
        "seq",
        "now",
        "view"
      ],
      "type": "object"
    }
  },
  "id": "games.cavu.tier-madness.subscribeGame",
  "lexicon": 1
}
```
