# com.fedproxy.temp.xrpc.subscribe

> Published by [johnandersen777.bsky.social](https://lexicon.garden/identity/did:plc:5svqtrhheairglgiiyvutzik)

✓ This is the authoritative definition for this NSID.

## Links

- [View on Lexicon Garden](https://lexicon.garden/lexicon/did:plc:5svqtrhheairglgiiyvutzik/com.fedproxy.temp.xrpc.subscribe)
- [Documentation](https://lexicon.garden/lexicon/did:plc:5svqtrhheairglgiiyvutzik/com.fedproxy.temp.xrpc.subscribe/docs)
- [Examples](https://lexicon.garden/lexicon/did:plc:5svqtrhheairglgiiyvutzik/com.fedproxy.temp.xrpc.subscribe/examples)

## Definitions

### `com.fedproxy.temp.xrpc.subscribe`

**Type**: `subscription`

Open a relay channel. The subscriber presents a com.fedproxy.temp.xrpc.registration: a record signed (network.attested.signature) over the nonce previously issued by com.fedproxy.temp.xrpc.getRegistrationNonce. The relay verifies the registration's signatures against the issued nonce and the did:key, then binds the WebSocket to that key. On connect the relay sends a #registered frame with the assigned serviceId/proxyRef; subsequent #request frames carry inbound XRPC calls the subscriber answers with #response frames.

```json
{
  "type": "subscription",
  "errors": [
    {
      "name": "InvalidRequest",
      "description": "Malformed or missing registration."
    },
    {
      "name": "Unauthorized",
      "description": "Registration signatures do not verify against the issued nonce or did:key, or the nonce is unknown/expired."
    }
  ],
  "message": {
    "schema": {
      "refs": [
        "#registered",
        "#request",
        "#response"
      ],
      "type": "union"
    }
  },
  "parameters": {
    "type": "params",
    "required": [
      "registration"
    ],
    "properties": {
      "registration": {
        "type": "string",
        "description": "The full com.fedproxy.temp.xrpc.registration object as URL-encoded JSON, signing the nonce from getRegistrationNonce. Sent inline (not an AT-URI) so the subscriber needs no PDS to host the record."
      }
    }
  },
  "description": "Open a relay channel. The subscriber presents a com.fedproxy.temp.xrpc.registration: a record signed (network.attested.signature) over the nonce previously issued by com.fedproxy.temp.xrpc.getRegistrationNonce. The relay verifies the registration's signatures against the issued nonce and the did:key, then binds the WebSocket to that key. On connect the relay sends a #registered frame with the assigned serviceId/proxyRef; subsequent #request frames carry inbound XRPC calls the subscriber answers with #response frames."
}
```

### `com.fedproxy.temp.xrpc.subscribe#request`

**Type**: `object`

An inbound XRPC call relayed to the subscriber to handle.

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `body` | `unknown` | No |  |
| `nsid` | `string` (nsid) | Yes |  |
| `method` | `string` | Yes |  |
| `params` | `unknown` | Yes | Query params as a map of string keys to string values. |
| `callerDid` | `string` (did) | Yes |  |
| `requestId` | `string` | Yes |  |

### `com.fedproxy.temp.xrpc.subscribe#response`

**Type**: `object`

The subscriber's reply to a #request, keyed by the same requestId.

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `body` | `unknown` | No |  |
| `status` | `integer` | Yes |  |
| `requestId` | `string` | Yes |  |
| `contentType` | `string` | No |  |

### `com.fedproxy.temp.xrpc.subscribe#registered`

**Type**: `object`

First frame sent by the relay on connect, assigning this subscriber a serviceId.

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `proxyRef` | `string` | Yes | did:web:HOST#serviceId value callers pass as the atproto-proxy header to route XRPC calls to this subscriber. |
| `serviceId` | `string` | Yes | Opaque id the relay assigns to this subscriber for the connection lifetime. |

## Raw Schema

```json
{
  "id": "com.fedproxy.temp.xrpc.subscribe",
  "defs": {
    "main": {
      "type": "subscription",
      "errors": [
        {
          "name": "InvalidRequest",
          "description": "Malformed or missing registration."
        },
        {
          "name": "Unauthorized",
          "description": "Registration signatures do not verify against the issued nonce or did:key, or the nonce is unknown/expired."
        }
      ],
      "message": {
        "schema": {
          "refs": [
            "#registered",
            "#request",
            "#response"
          ],
          "type": "union"
        }
      },
      "parameters": {
        "type": "params",
        "required": [
          "registration"
        ],
        "properties": {
          "registration": {
            "type": "string",
            "description": "The full com.fedproxy.temp.xrpc.registration object as URL-encoded JSON, signing the nonce from getRegistrationNonce. Sent inline (not an AT-URI) so the subscriber needs no PDS to host the record."
          }
        }
      },
      "description": "Open a relay channel. The subscriber presents a com.fedproxy.temp.xrpc.registration: a record signed (network.attested.signature) over the nonce previously issued by com.fedproxy.temp.xrpc.getRegistrationNonce. The relay verifies the registration's signatures against the issued nonce and the did:key, then binds the WebSocket to that key. On connect the relay sends a #registered frame with the assigned serviceId/proxyRef; subsequent #request frames carry inbound XRPC calls the subscriber answers with #response frames."
    },
    "request": {
      "type": "object",
      "required": [
        "requestId",
        "method",
        "nsid",
        "params",
        "callerDid"
      ],
      "properties": {
        "body": {
          "type": "unknown"
        },
        "nsid": {
          "type": "string",
          "format": "nsid"
        },
        "method": {
          "type": "string"
        },
        "params": {
          "type": "unknown",
          "description": "Query params as a map of string keys to string values."
        },
        "callerDid": {
          "type": "string",
          "format": "did"
        },
        "requestId": {
          "type": "string"
        }
      },
      "description": "An inbound XRPC call relayed to the subscriber to handle."
    },
    "response": {
      "type": "object",
      "required": [
        "requestId",
        "status"
      ],
      "properties": {
        "body": {
          "type": "unknown"
        },
        "status": {
          "type": "integer"
        },
        "requestId": {
          "type": "string"
        },
        "contentType": {
          "type": "string"
        }
      },
      "description": "The subscriber's reply to a #request, keyed by the same requestId."
    },
    "registered": {
      "type": "object",
      "required": [
        "serviceId",
        "proxyRef"
      ],
      "properties": {
        "proxyRef": {
          "type": "string",
          "description": "did:web:HOST#serviceId value callers pass as the atproto-proxy header to route XRPC calls to this subscriber."
        },
        "serviceId": {
          "type": "string",
          "description": "Opaque id the relay assigns to this subscriber for the connection lifetime."
        }
      },
      "description": "First frame sent by the relay on connect, assigning this subscriber a serviceId."
    }
  },
  "$type": "com.atproto.lexicon.schema",
  "lexicon": 1
}
```
