{ "lexicon": 1, "id": "com.fedproxy.temp.xrpc.subscribe", "defs": { "main": { "type": "subscription", "description": "The subscriber's WebSocket to the did:key ingress relay (the Go relay `socialweb-computer internal ingress-relay`, at xrpc.fedproxy.com): a bidder or requester holds it open so that HTTP requests and WebSocket subscriptions sent to its host, ., are carried to it and answered over this socket. Served on the relay's own hostname only, as a GET with a WebSocket upgrade. Before it, the subscriber gets a nonce from com.fedproxy.temp.xrpc.getRegistrationNonce, signs the nonce bytes and puts the signed com.fedproxy.temp.xrpc.registration in the registration parameter. Authentication is a service-auth JWT (ES256K or ES256, aud did:web:, lxm com.fedproxy.temp.xrpc.subscribe, exp required, 5 s leeway) in the Authorization header as Bearer, or in the service_auth parameter when the client cannot set headers (a browser). After the upgrade the relay checks the registration (nonce known, unexpired and issued for registration.key, one signature that verifies over the nonce bytes), that did equals registration.key, and its own DID allowlist when one is configured; a failure closes the socket with code 1008 and the reason (did query param must be a DID, malformed registration, registration rejected: , did does not match registration key, DID not in allowlist). On success the relay sends #registered; a later subscriber with the same DID replaces the earlier one. Unlike the XRPC event-stream framing (CBOR header and body in binary frames), every message in both directions is one JSON text frame, an object whose $type names its kind: com.fedproxy.temp.xrpc.subscribe# for the frames here, com.fedproxy.temp.xrpc.alias and com.fedproxy.temp.xrpc.alias#result for custom domains. The relay also parses binary frames as JSON; a frame that is not JSON, or of a kind it does not know, is ignored. A frame is at most 64 MiB. Every 5 s the relay sends a #request GET /xrpc/com.publicdomainrelay.temp.keepalive.ping that the subscriber must answer with a #response; a subscriber that has answered nothing for 90 s is closed with code 1011 (subscriber unresponsive for s). The connection lives as long as the service-auth token: the relay closes it with code 1008 (service auth token expired) at the token's exp unless a #renew with a newer token came first, and with code 1001 (server shutting down) when it stops.", "parameters": { "type": "params", "required": ["did", "registration"], "properties": { "did": { "type": "string", "format": "did", "description": "The subscriber's DID; it must equal registration.key. Its label (the DID lowercased, every colon replaced by a hyphen) is the subscriber's subdomain under the relay hostname." }, "registration": { "type": "string", "description": "The signed com.fedproxy.temp.xrpc.registration object, as JSON text (URL-encoded in the query)." }, "service_auth": { "type": "string", "description": "The service-auth JWT for lxm com.fedproxy.temp.xrpc.subscribe, used only when there is no Authorization header." } } }, "message": { "schema": { "type": "union", "refs": ["#registered", "#renew", "#renewed", "#request", "#response", "#subscribe", "#subscriptionOpen", "#subscriptionEvent", "#subscriptionData", "#subscriptionClose", "#subscriptionCancel", "com.fedproxy.temp.xrpc.alias", "com.fedproxy.temp.xrpc.alias#result"] } }, "errors": [ { "name": "AuthenticationRequired", "description": "401, as HTTP JSON {error, message} before the upgrade: the Authorization header is not Bearer , there is no token at all, or the service-auth token does not verify (signature, aud, lxm, exp)." }, { "name": "NoSubscriber", "description": "503, as HTTP JSON to a caller of a subscriber's host (not on this socket): no subscriber holds that host now. A WebSocket caller of such a host is instead closed with code 4004 (no active subscriber for subdomain