Specification · document 03
03 Client transport, envelopes and errors
| Status | Draft. Protocol version 1 (sv1) of the Sloppy Voice v2 product |
| Date | 2026-12-04 |
| Depends on | 00-overview.md |
| Decisions used | D-004, D-007, D-010, D-012, D-016, D-017, D-025, D-026, D-027, D-028, D-031, D-032, D-037, D-038, D-046, D-051, D-062, D-065, D-066, D-078, D-079, D-084, D-094 |
| Owns | HTTP API rules and CORS policy; the /v1/events WebSocket; the envelope; session.* messages and events; seq, durable and ephemeral semantics, the withheld payload form, resume; the identifier format registry; the error object and userAction enum; the error-code registry and area allocation; core.* and session.* error codes; the event-type registry (index); the feature registry and version negotiation; pagination, idempotency and rate-limit conventions; maxRequestBytes, maxEventBytes, maxSubscriptions, maxReplayEvents; the terms Context and Context reference |
Status of this document and conformance
This document is normative. It applies to every conformance class of 00 §1.5: Server, SFU-capable server, Full client, Web client, Bot client and, for §2 to §4 and §10, Push gateway. A server conforms to this document only if every endpoint it serves, including endpoints owned by other documents, follows the rules here. A client conforms only if it follows the client rules here for every server it talks to.
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" are to be interpreted as described in BCP 14 (RFC 2119, RFC 8174) when, and only when, they appear in all capitals, as shown here. Grammars use ABNF (RFC 5234) with the core rules of its Appendix B. Examples are informative unless the text says otherwise. Where an example and the normative text disagree, the normative text wins. Rationale notes start with "Rationale:" and are informative (00 §7.16).
This document elaborates 00 §7.3, §7.4 and §7.6 to §7.12 and contains everything stated there. Where this document says "the owner", it means the document that owns the named object, endpoint, event type or error code under 00 §1.6, §7.3 and §7.5.
1. Scope
1.1 What this document covers
- The rules every HTTPS endpoint follows: TLS, media types, JSON handling, method semantics, status codes, path and query parameters, redirects and caching (§2).
- The authorization header schemes at the transport level (§3) and the CORS policy (§4).
- The event WebSocket at
{base}/v1/events, its connection lifecycle and everysession.*message (§5). - The envelope (§6), and sequencing, durable and ephemeral events, resume, resync and backpressure (§7).
- The identifier format registry (§8), timestamps and durations (§9).
- The error object, the
userActionenum, the error-code registry with its area allocation, and thecore.*andsession.*codes (§10). - The event-type registry (§11), the feature registry and version negotiation (§12).
- Pagination (§13), idempotency (§14), rate limits (§15) and size limits (§16).
1.2 What it does not cover
This document defines no business endpoint, no event payload and no error code outside the core and session areas. It indexes them with their owners (§10.7, §11.3). In particular it does not define: token issuance, lifetimes or refresh (05, 06); ServerMetadata and its members (02), although it defines the semantics of versions, features, minClient and the four limits it owns; the S2S request token and the S2S event envelope (06); the JWS profile (04); or message, MLS, call or notification payloads (11 to 19).
1.3 Terminology
This section defines the glossary terms that 00 §2.6 assigns to this document, plus terms used only here. It doesn't redefine any other 00 §2 term.
| Term | Definition |
|---|---|
| Context | Anything with members and a message timeline: a channel, a 1:1 DM or a group DM. Each context lives on exactly one hosting server. |
Context reference (ctx) |
The typed ID of a context on its hosting server: ch:<UUIDv7>, dm:<22 base64url characters> or gdm:<UUIDv7> (§8.3). |
| Client session | What a token on a client request identifies: a home session (05), a remote session (06) or the session of a bot token (05). A client session belongs to one account and one device (did). |
| Stream | A sequence of durable events with its own seq counter on one server. There are three kinds: one per context (named by its context reference), the account stream me (one per account per server), and the community stream community (one per server) (§7.1). |
| Durable event | An event that carries a seq in exactly one stream, is retained for replay and is delivered to every full subscriber of that stream (§7.2). |
| Ephemeral event | An event that carries no seq and is never replayed (§7.2). |
| Control message | A session.* message or an error envelope. Control messages carry no seq and are never replayed. |
| Subscription | A socket's registration to receive a stream, at level full or heads (§5.6). |
| Connected session | A client session that has an open event WebSocket on that server that has received session.ready. |
| Online for a stream | A connected session whose socket holds a full subscription to that stream. An owner that picks sessions for a duty (for example the designated committer in 13 under D-037) says whether it requires "connected" or "online for the stream". Targeted events reach every connected targeted session either way (§7.2 E5). |
| Targeted event | An ephemeral event that its owner sends to particular client sessions or devices rather than to every subscriber of its stream (§7.2 E5). |
| Foreground session | A connected session whose client last declared foreground: true (§5.8). 19 builds its attentive session (foreground and not idle, 19 §4.3) on it to decide when notify is sent. |
| Principal | The authenticated party of a request: a client session, or a sending server for S2S requests. |
2. HTTPS API rules
2.1 Base URL and endpoint URLs
- Every endpoint is relative to the server's base URL (02). The base URL has the scheme
https, no query, no fragment and no trailing slash. A path is appended to it directly: the base URLhttps://chat.sloppyvoice.com/serverand the path/v1/communitygivehttps://chat.sloppyvoice.com/server/v1/community. {base}/metais unversioned. Every other endpoint is under{base}/v1/.https://<fqdn>/.well-known/sloppyv(02) is at the domain's origin root, not under the base URL.- Paths are case-sensitive. Path segments defined by this specification are lowercase. Clients MUST NOT add a trailing slash. A server MUST NOT treat a path with a trailing slash as a different resource; it SHOULD answer it with 404
core.not_found. - Endpoints are owned as listed in 00 §7.3. A document MUST NOT define an endpoint under another document's paths. A path under
/v1/that the server doesn't implement returns 404core.not_foundwithdata.reasonunknown_endpoint; the caller treats it as "feature absent" (§12.3). An endpoint the server implements but whose optional feature is turned off returns 501core.unsupported_featureinstead (§12.2).
2.2 TLS
- Every request uses HTTPS. A client MUST NOT send any request, token or WebSocket handshake over plain HTTP or plain
ws:. A server MUST NOT serve the API over plain HTTP. It MAY answer plain-HTTP requests with a redirect to HTTPS, but clients never rely on that redirect. - TLS 1.2 (RFC 5246) is the minimum, and TLS 1.3 (RFC 8446) is RECOMMENDED. With TLS 1.2, servers MUST offer only cipher suites with ECDHE key exchange and AEAD encryption, following RFC 9325. TLS compression MUST NOT be used.
- Clients MUST validate the server certificate against the WebPKI for the base URL's host (RFC 9525). A client MUST NOT offer a way to ignore certificate errors in its normal user interface.
- Servers SHOULD NOT accept TLS 1.3 early data (0-RTT). A server that accepts it MUST process early data only for
GETrequests and MUST answer other methods received in early data with 425core.too_earlyper RFC 8470. A client retries such a request once at once over the completed handshake, without early data. - Servers SHOULD send
Strict-Transport-Security(RFC 6797) withmax-ageof at least 31,536,000 seconds.
2.3 HTTP versions, connections, redirects and caching
- Any HTTP version may be used: HTTP/1.1, HTTP/2 or HTTP/3. The WebSocket MAY be carried over HTTP/2 (RFC 8441) or HTTP/3 (RFC 9220) where both ends support it.
- Redirects. Servers SHOULD NOT redirect
/v1/endpoints, apart from the browser-navigation endpoints of §2.9 and owner-defined capability-URL redirects (§3.2 item 1). A client MAY follow a 307 or 308 redirect whose target has the same origin as the base URL. A client MUST NOT follow any redirect to another origin while sendingAuthorization, and MUST NOT follow 301, 302 or 303 for a request other thanGET. - Caching. Every response to an authenticated request MUST carry
Cache-Control: no-store. Owners of public endpoints (for example/meta,/v1/users/{local}/identity) define their own caching. A server MAY sendETagonGETresponses and honourIf-None-Matchwith 304. - Date and clock offset. Servers MUST send a correct
Dateheader. Device clocks are often minutes off, so a client MUST estimate its clock offset to each server from that server'sDateheaders and envelopetsvalues, and MUST use the corrected time foriat,nbfandexpin every signed object it builds for that server (for example a DeviceProof, 06), and for objects addressed to no particular server, the offset to its home server. It SHOULD also use the corrected time for the time field of the UUIDv7s it generates. It MUST NOT change the device clock. - Request timeout. A server SHOULD answer every request within 30 s. An operation that can take longer is modelled by its owner as 202 Accepted followed by an event. A client SHOULD time out a request after 30 s unless the owner states a longer bound, and then treats it as an ambiguous failure (§2.8).
- Client identification. Clients other than browsers SHOULD send
User-Agentas<product>/<version>(for examplesloppyvoice-desktop/1.0.3). Servers MUST NOT change behaviour based onUser-Agent, apart from logging and diagnostics.
2.4 Media types and JSON
- Every request body and every successful response body is JSON (RFC 8259) restricted to I-JSON (RFC 7493) (D-028), encoded as UTF-8 without a byte-order mark, with
Content-Type: application/json. Error responses useapplication/problem+json(§10.1). The only exceptions are endpoints whose owner explicitly defines a non-JSON body, such as attachment upload and download (11), whose bodies are opaque bytes withContent-Type: application/octet-streamunless the owner says otherwise, and the browser-navigation and OAuth endpoints of §2.9. - HTTP bodies are not envelope-wrapped. A request or response body is the plain JSON object the endpoint's owner defines. The envelope of §6 exists only on the WebSocket.
- The top-level value of every JSON body MUST be an object. An endpoint that returns a list returns it inside an object (for example
{"items": [...]}, §13). - A server MUST answer a request that has a body with a
Content-Typeother thanapplication/json(parameters ignored, except that acharsetother thanutf-8is an error) with 415core.unsupported_media_type, unless the owner defines another body type (§2.9). Servers ignoreAccept. Clients MUST accept bothapplication/jsonandapplication/problem+json. - A server MUST reject, with 400
core.invalid_request, a body that isn't well-formed JSON, isn't valid I-JSON (for example it contains an unpaired surrogate or a number outside the IEEE 754 double range), or contains a duplicate member name in any object. Producers MUST NOT emit duplicate member names (00 §7.2). - Unknown members. Receivers MUST ignore members they don't know, in request bodies, response bodies, envelopes and payloads alike. A server MUST NOT reject a request because of an unknown member.
- Absent and null. Unless the owner says otherwise, an optional member that is absent and the same member set to
nullmean the same thing. Producers SHOULD omit optional members rather than sendnull. A required member MUST be present, and MUST be non-null unless its type includes null (for examplenextCursor, §13.2).PATCHgivesnulla specific meaning (§2.5). - Integers are at most 2^53 − 1 in magnitude (00 §7.2). A member typed as integer MUST NOT have a fractional part or exponent. A value that may exceed 2^53 − 1 is sent as a decimal string with no leading zeros, and its owner says so.
- Booleans are JSON
trueandfalse, never strings or numbers. - Strings are Unicode text. This document imposes no normalization on strings in general; addresses are NFC as 01 defines. Length limits stated in characters count Unicode code points; limits stated in bytes count UTF-8 bytes.
- Binary values are base64url without padding (RFC 4648 §5). Decoders MUST reject padding, characters outside the alphabet, white space, and encodings whose unused trailing bits are not zero (non-canonical encodings, RFC 4648 §3.5).
- Member names are lowerCamelCase; enum values are lowercase snake_case (00 §7.5).
Proposed decision: base64url decoders reject non-canonical encodings (non-zero unused trailing bits) everywhere in the protocol. Rationale: every binary value, such as a did, then has exactly one string form. Otherwise two spellings of one device ID could bypass a uniqueness check or a ban.
2.5 Methods and status codes
Methods.
| Method | Semantics | Body | Safe | Idempotent |
|---|---|---|---|---|
GET |
Read a resource or collection. | None. A server MUST ignore a body sent with GET. |
Yes | Yes |
POST |
Create a resource, or perform an action the owner names. | JSON object | No | Only with a client-generated ID or Idempotency-Key (§14) |
PUT |
Create or replace the whole resource at a known URL. | JSON object | No | Yes |
PATCH |
Change some members of a resource. | JSON object, rules below | No | Only with Idempotency-Key, or when the owner says so |
DELETE |
Remove a resource. | None unless the owner defines one | No | Yes |
OPTIONS |
CORS preflight (§4). | None | Yes | Yes |
HEAD |
Servers MAY support it for any GET endpoint. |
None | Yes | Yes |
A method an endpoint doesn't support returns 405 core.method_not_allowed with an Allow header.
PATCH semantics. The body is a JSON object listing only the members to change, sent as application/json. A member that is absent stays unchanged. A member set to null clears an optional member and is invalid for a required one. A member whose value is an object or array replaces the stored value wholesale, unless the owner defines finer merging. An owner MAY define control members that aren't resource members, such as dryRun (09). The response is the full updated resource, unless the owner says otherwise.
DELETE semantics. Success is 204 No Content. A repeated DELETE of something already deleted returns 204, 404 core.not_found or 410 core.gone, at the owner's choice; a client retrying a DELETE MUST treat all three as success.
Status codes. Servers use these codes with these meanings. An owner MAY use another code only by defining a registered error code for it (for example 425 mls.commit_busy in 13).
| Status | Use |
|---|---|
| 200 OK | Success with a body. |
| 201 Created | A resource was created. The body is the resource. Location SHOULD give its URL. A replayed idempotent create returns the status the owner defines, by default the original status (§14). |
| 202 Accepted | Accepted for asynchronous processing; the owner names the event that reports completion. |
| 204 No Content | Success with no body. |
| 304 Not Modified | Conditional GET only. |
| 400 Bad Request | core.invalid_request, core.unsupported_version, or an owner's validation code. |
| 401 Unauthorized | core.unauthenticated, core.token_expired, an owner's authentication code (05, 06, 15, 19), or a crypto.* or discovery.* code under 04 §6.9. Always with WWW-Authenticate (§3.3). |
| 403 Forbidden | core.forbidden, security.* and owners' permission codes. |
| 404 Not Found | core.not_found. |
| 405 Method Not Allowed | core.method_not_allowed. |
| 409 Conflict | core.conflict, core.idempotency_conflict, and owners' state codes such as mls.epoch_conflict. |
| 410 Gone | core.gone. |
| 413 Content Too Large | core.too_large. |
| 415 Unsupported Media Type | core.unsupported_media_type. |
| 425 Too Early | core.too_early (TLS early data, §2.2 item 4), and 13's mls.commit_busy (MLS commit overload). Clients tell them apart by code (§10.3). |
| 429 Too Many Requests | core.rate_limited. |
| 500 Internal Server Error | core.internal. |
| 501 Not Implemented | core.unsupported_feature. |
| 503 Service Unavailable | core.unavailable. |
Every 4xx and 5xx response that a conforming server generates MUST carry a problem object (§10.1). A client MUST also handle 4xx and 5xx responses without a problem object, which proxies and load balancers produce, as §10.3 says.
2.6 Path and query parameters
- Context references in paths. A context reference is one path segment, for example
/v1/contexts/ch:01938a11-2b3c-7d4e-8f90-112233445566/messages. A colon is a valid character in a path segment (RFC 3986pchar). Clients MAY percent-encode the colon as%3Aor%3a. Servers MUST accept the plain and both encoded forms and MUST treat them as the same resource. Servers decode each segment exactly once; a segment that still contains%after decoding is not decoded again. - Other path parameters. Characters outside RFC 3986
pcharare percent-encoded as UTF-8 (RFC 3986 §2.1). Address local parts in paths (01, 05, 07) follow this rule; 01 defines the accepted forms of{local}. A path parameter that doesn't match its identifier grammar (§8) returns 400core.invalid_request; a well-formed one that names nothing returns 404core.not_found. - The
mesegment in paths such as/v1/me/devicesnames the caller's own account. It is a path segment and not a stream name, although the two are spelled the same. - Query parameters have lowerCamelCase names and percent-encoded UTF-8 values (
application/x-www-form-urlencodedserialization is acceptable;+means a space only in that serialization and servers MUST accept both+and%20). Booleans aretrueorfalse. Integers are decimal with no leading zeros. Lists are comma-separated in one parameter, unless the owner says otherwise. A repeated parameter that the owner didn't define as repeatable returns 400core.invalid_request. Unknown query parameters are ignored. - Query parameters MUST NOT carry tokens or other secrets (§3.2).
2.7 Retrying requests
A client retries a failed request automatically only if all of these hold:
- the failure is a network error, a timeout, or a response whose problem object has
retryable: true(or, without a problem object, status 502, 503 or 504); - the request is idempotent:
GET,HEAD,PUTorDELETE, or aPOSTorPATCHthat carries a client-generated ID orIdempotency-Key(§14); - the user hasn't cancelled the action.
The delay before retry n (starting at n = 0) is a uniformly random value in [0, min(30 000, 500 × 2^n)] ms ("full jitter"), but never less than retryAfterMs or Retry-After when the response gave one. A client SHOULD stop automatic retries of a user action after 5 attempts, or earlier where the owner says so, and then show the problem's userAction (§10.2). The outbox for messages (11) and the call rejoin schedule (15) define their own longer schedules and take precedence.
A client MUST NOT automatically retry a non-idempotent request after an ambiguous failure (the request may have been processed). It MAY ask the user.
2.8 Ordering between HTTP responses and events
A state change made by an HTTP request is usually also reported as an event on the WebSocket (for example POST …/messages and message.created). The event and the HTTP response can arrive in either order. Clients MUST handle both orders, reconciling by the object's ID (for messages, the mid).
A seq value that a client learns from an HTTP response or a page (§13) MUST NOT advance the client's stream position (§7.3). Positions advance only by processing events in order on the socket, or by a resync (§7.5).
Rationale: a client that jumped its position to a seq it saw in an HTTP response would silently skip the events in between.
2.9 Browser-navigation and OAuth endpoints
Login runs partly in a browser and uses standard OAuth libraries (05, D-016), so a few /v1/auth/ endpoints can't follow §2.4 exactly. These are the only exceptions, and 05 defines each one:
- Browser-navigation endpoints that 05 marks as such (
/v1/auth/authorize,/v1/auth/callbackand/v1/auth/consent) are visited by a browser, not called by API code. They MAY return HTML pages and redirects (302 or 303), MAY accept the form-encoded body of 05's own consent page, and MAY set and read 05's short-lived, path-scoped transaction cookie. That cookie binds a sign-in to the browser that started it; it never authorizes an API request (§3.2 item 2). - OAuth endpoints (
/v1/auth/parand/v1/auth/token) MAY acceptapplication/x-www-form-urlencodedbodies as well as JSON, and use the RFC 6749 member names (access_token,expires_inand so on). Their errors are still problem objects (§10.1), with whatever extra members 05 adds. Their HTTP statuses follow 05 §7.8.
Every other rule of this document still applies to these endpoints, including CORS (§4), the token rules of §3.2 and the problem object for errors.
These are the only exceptions to the JSON-only, no-redirect and no-cookie rules (D-026 as revised, D-079, 00 §7.2, §7.3).
3. Authorization
3.1 Schemes
| Scheme | Credential | Issued by | Used on | Owner |
|---|---|---|---|---|
Bearer |
Home-session access token (opaque) | The account's home server | Client endpoints at the home server | 05 |
Bearer |
Remote-session access token (opaque) | A remote server, from a HomeAssertion (D-004, D-062) | Client endpoints at that remote server | 06 |
Bot |
Bot token (opaque) | The bot's home server | Client endpoints at the bot's home server only. At other servers a bot obtains a HomeAssertion with its bot token (06) and uses a Bearer remote-session token, exactly as a user does. |
05 |
Bearer |
S2S request token (sv-s2s+jwt JWS, D-027) |
The sending server | S2S endpoints only, as listed in 06 §8.1 (06, /v1/federation/keypackages/claim in 13, /v1/community/membership-check in 09, and 10's report evidence and attachment endpoints) |
06 |
Bearer |
Sign-up token (opaque, svs_ prefix) |
The home server | POST /v1/auth/signup only |
05 |
Bearer |
Fetch token (opaque, 19 §9.3) | The account's home server, with a push registration | Only GET /v1/me/notifications/{id} and POST /v1/me/notifications/read (ids selector) at that home server; misuse 403 core.forbidden, invalid 401 core.unauthenticated |
19 |
Bearer |
Event ticket (opaque, 19 §4.7) | A hosting server, inside notify.event |
Only GET /v1/me/notifications/events at that server; every failure 401 notify.ticket_invalid |
19 |
Bearer |
Push request token (sv-push+jwt JWS) |
The home server | {gatewayUrl}/v1/push of a push gateway only |
19 |
Bearer |
Webhook token (whk_ + base64url of 32 random bytes, 11 §15) |
The hosting server, to a channel admin | Only POST /v1/contexts/{ctx}/webhooks/{id}/messages (11 §15.4) |
11 |
authorization = auth-scheme 1*SP credentials
auth-scheme = "Bearer" / "Bot" ; ABNF strings are case-insensitive
credentials = 1*4096token-char
token-char = ALPHA / DIGIT / "-" / "." / "_" / "~" / "+" / "/" / "="The scheme name is matched case-insensitively (RFC 9110 §11.1). Clients SHOULD send Bearer and Bot exactly as spelled here. The credential syntax is the token68 form of RFC 9110, limited to 4,096 characters. Opaque tokens SHOULD use only base64url characters and MAY carry a short issuer-chosen prefix, such as rs_; clients MUST treat tokens as opaque.
3.2 Rules for every token
- Never in URLs. Client-session tokens, bot tokens and S2S request tokens MUST NOT appear in a URL, including query strings and fragments, in any request or link. Servers MUST NOT accept the
access_tokenquery parameter of RFC 6750 §2.3 or any other query or path form of those tokens. On the WebSocket the token travels insidesession.hello(§5.4) because browsers can't set headers on WebSocket handshakes. Capability URLs are the one exception: an owner MAY define a URL that itself grants access to exactly one object, expires within 10 minutes, carries at least 128 bits of unguessable randomness and contains no session, bot or S2S token, for example 11's attachment download and pre-signed upload URLs. Clients and servers MUST NOT log capability URLs. - No ambient credentials. No cookie or other ambient credential ever authorizes an API request (00 §7.3). Servers MUST NOT accept cookies, HTTP authentication caches or TLS client certificates as authorization on any endpoint. The only cookie in the protocol is 05's transaction cookie on the browser-navigation endpoints of §2.9, which authorizes nothing, and every other endpoint MUST ignore it.
- Only to the issuer. A client MUST send a token only to the base URL of the server that issued it. A remote-session token for
b.comis never sent toa.com, a home-session token is never sent to a remote server, and a bot token is never sent to any server other than the bot's home server. If discovery later gives a different base URL for that server, the client MUST NOT send the old token to the new base URL unless its own pin for that server accepts the change under 02 §10.2 (strong evidence or a URL-bound KeyRotation, 02 §10.6); otherwise it obtains a new session there. - Endpoint classes. Client endpoints accept
Bearerclient-session tokens andBottokens. S2S endpoints accept onlyBearerS2S request tokens. A server MUST answer an S2S token on a client endpoint with 401core.unauthenticated(except as rule 8 says). A client token on an S2S endpoint is answered with 401 and the code 06 defines for S2S authentication failures (federation.s2s_unauthenticated). The fetch token and the event ticket (19) are accepted only on the endpoints 19 names for them; they aren't session tokens and are never refreshed. On 11's webhook execution endpoint only, webhook tokens are accepted. Any other credential presented on an endpoint that doesn't accept its kind is answered with 401core.unauthenticated, unless its owner defines another answer (19: 403core.forbiddenfor a misused fetch token; rule 8). In particular, a client-session credential that its issuer limits to one endpoint (05's sign-up token) is answered with 401core.unauthenticatedon every other endpoint. - One credential per request. A request MUST carry at most one
Authorizationheader. A request with more than one is answered with 400core.invalid_request. - Public endpoints. An owner marks an endpoint public (no credential needed), for example
/meta,/v1/resolve,/v1/users/{local}/identity,/v1/users/{local}/profileand parts of/v1/auth/. If a request to a public endpoint carries anAuthorizationheader that isn't valid, the server MUST answer 401 as for any other endpoint, so that a client learns its token is stale (except as rule 8 says). - Logging. Servers, clients and gateways MUST NOT log
Authorizationheader values orsession.hellotokens, and MUST NOT echo them in problem objects. - Owner-defined exceptions. Rules 4 and 6 and §3.3 apply except in these cases, which their owners define: (a) on the public
GET/v1/lookups listed in 06 §10.3 (/v1/users/{local}/identity,/v1/users/{local}/profile,/v1/addresses/{local},/v1/resolve), a server MAY present an S2S token; the receiver verifies it or ignores it as 06 §8.1 says, and never answers 401 because of it; (b)POST /v1/auth/logoutwithscope: currentanswers 204 whatever the state of the token (05 §14); (c)GET /v1/me/notifications/eventsanswers every credential that isn't a valid event ticket with 401notify.ticket_invalid(19 §8.6).
3.3 Failed authentication
A 401 response MUST carry WWW-Authenticate (RFC 9110 §11.6.1) naming the schemes the endpoint accepts, with realm set to the server's canonical domain and, for Bearer, the RFC 6750 error parameter:
HTTP/1.1 401 Unauthorized
Content-Type: application/problem+json
Cache-Control: no-store
WWW-Authenticate: Bearer realm="sloppyvoice.com", error="invalid_token", error_description="expired", Bot realm="sloppyvoice.com"
{
"type": "urn:sloppyv:error:core.token_expired",
"code": "core.token_expired",
"title": "Session token expired",
"status": 401,
"retryable": true,
"userAction": "none"
}Exception: 05's POST /v1/auth/logout with scope: current answers 204 for an expired, revoked or unknown token (05 §14; §3.2 rule 8).
A client recovers without bothering the user wherever it can:
| Code | Home session | Remote session | Bot |
|---|---|---|---|
core.token_expired |
Refresh the access token silently (05), then retry once. | Get a fresh HomeAssertion from the home server and create a new remote session silently (06 §6.1, §6.10), then retry once. | Retry is pointless; report to the bot operator. |
core.unauthenticated |
Try one refresh. If that fails, show sign_in: the user signs in again with OIDC (M1, D-016). |
Create a new remote session silently. Only if the home server also answers core.unauthenticated does the client show sign_in. |
Stop and report; the token was revoked or rotated. |
Rationale: remote sessions are cheap to recreate from the home session, so a remote server's 401 never shows a sign-in screen by itself. Users see a sign-in prompt only when their home session is really gone.
4. CORS
Web clients (D-010) talk to many servers from one origin, so the API is open to every origin. This is safe because no endpoint accepts ambient credentials (§3.2, D-026).
- Every response from
https://<fqdn>/.well-known/sloppyv,{base}/metaand every{base}/v1/endpoint, including error responses and S2S endpoints, MUST carryAccess-Control-Allow-Origin: *. - Servers MUST NOT send
Access-Control-Allow-Credentials. - A preflight (
OPTIONSwithAccess-Control-Request-Method) to any of those URLs MUST be answered with 204 and:
| Header | Value |
|---|---|
Access-Control-Allow-Origin |
* |
Access-Control-Allow-Methods |
GET, HEAD, POST, PUT, PATCH, DELETE |
Access-Control-Allow-Headers |
Authorization, Content-Type, Idempotency-Key, If-None-Match (a server MAY list more) |
Access-Control-Max-Age |
86400 (browsers MAY cap it lower) |
- Responses MUST carry
Access-Control-Expose-Headerslisting at leastRetry-After, RateLimit, RateLimit-Policy, Location, WWW-Authenticate, ETag, Deprecation, Sunset, Link. - A preflight is answered without authentication and without rate-limit headers, and MUST NOT count against the session rate limit (it MAY count against the per-IP limit).
- Servers MUST NOT make any authorization decision on the
Originheader. They MAY log it.
Authorization must be listed explicitly because the * wildcard in Access-Control-Allow-Headers doesn't cover it (Fetch standard).
OPTIONS /server/v1/contexts/ch:01938a11-2b3c-7d4e-8f90-112233445566/messages HTTP/1.1
Host: chat.sloppyvoice.com
Origin: https://web.example.org
Access-Control-Request-Method: POST
Access-Control-Request-Headers: authorization, content-type, idempotency-key
HTTP/1.1 204 No Content
Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: GET, HEAD, POST, PUT, PATCH, DELETE
Access-Control-Allow-Headers: Authorization, Content-Type, Idempotency-Key, If-None-Match
Access-Control-Max-Age: 86400If-None-Match is listed because it isn't a CORS-safelisted request header, and servers MAY honour it (§2.3 item 3); a web client that sent it to a server listing only the 00 §7.3 minimum would otherwise fail its preflight.
Rationale: Content-Type: application/json makes every write a non-simple request, so browsers always send a preflight. Even a request that skipped the preflight would carry no credentials, so cross-site request forgery has nothing to ride on (§18).
5. The event WebSocket
5.1 Endpoint and handshake
- The event WebSocket (RFC 6455) is at
{base}/v1/events, with the base URL'shttpsscheme replaced bywss. For the base URLhttps://chat.sloppyvoice.com/serverit iswss://chat.sloppyvoice.com/server/v1/events. The URL MUST NOT carry a query string or fragment. - The client MUST offer the subprotocol
sloppyv.v1inSec-WebSocket-Protocol(D-025). A client that supports later versions lists them first, in its order of preference, for examplesloppyv.v2, sloppyv.v1. - The server MUST select one offered subprotocol it supports. If the client offered none it supports, the server MUST refuse the handshake with HTTP 400 and a
core.unsupported_versionproblem. A client whose handshake succeeds with no subprotocol, or with one it didn't offer, MUST close the connection with 1002. - The handshake itself is unauthenticated: authentication happens in
session.hello(§5.4). The server MUST NOT use theOriginheader to authorize, and MAY log it. Servers rate-limit handshakes per IP address (§15). When the client offered a subprotocol the server supports, the server SHOULD complete an over-limit handshake and refuse it in-band (errorwithcore.rate_limited,session.closingwithrate_limitedandretryAfterMs, close 4029); otherwise it answers HTTP 429 with acore.rate_limitedproblem. - Handshake failures that a client can't read. Browsers expose neither the status nor the body of a failed handshake; a script sees only an
errorevent and close code 1006. A client that can't read the handshake response treats every handshake failure as a network failure and backs off (§5.11). Such a client, and every client, reads{base}/metabefore its first connection to a server and again after 3 consecutive handshake failures, and appliesversionsandminClientfrom it (§12.1, §12.4); that is how a web client learns that it must show "update required". - The
permessage-deflateextension (RFC 7692) MAY be negotiated only with bothserver_no_context_takeoverandclient_no_context_takeover. A server MUST NOT accept the extension without including both parameters in its response; RFC 7692 §7.1.1.1 and §7.1.1.2 let it include either parameter even when the client didn't offer it. A client that receives an extension response without both parameters MUST close the connection (§18.5). Clients other than browsers SHOULD NOT compresssession.helloorsession.reauth, which carry tokens. (Browsers give scripts no per-message control of compression, which is why the server-side parameters are mandatory.) - CORS doesn't apply to WebSocket handshakes. The handshake response carries no CORS headers.
5.2 Frames
- Every WebSocket message is one envelope (§6): a JSON object serialized as UTF-8 and sent as a text message. A message may be fragmented into several frames as RFC 6455 allows.
- A receiver that gets a binary message closes with 1003. A text message that isn't valid UTF-8 is closed with 1007.
- A server that receives a text message that isn't a JSON object, or that lacks a required envelope member, sends an
errorwithcore.invalid_request, thensession.closingwith reasonprotocol_error, and closes with 4000. A client that receives such a message from the server drops it, closes with 4000 and reconnects with resume (§5.11). Resume recovers any durable event the bad message might have been. - No message in either direction may exceed
maxEventBytes(§16). A receiver that gets a larger message closes with 1009. - WebSocket Ping and Pong control frames MAY be used by either side. They don't replace
session.ping(§5.9), because browser code can't observe them. - Close codes from browsers. Browser WebSocket APIs let a script close only with 1000 or with a code from 3000 to 4999. Wherever this document tells a client to close with 1002, 1003, 1007 or 1009, a client that can't send that code closes with 4000 instead.
5.3 Connection lifecycle
Server state machine (per socket).
| State | Event | Action | Next state |
|---|---|---|---|
awaiting_hello |
Valid session.hello |
Authenticate; apply subscriptions (§5.6); send session.ready; then send session.resync_required and replays (§7.4) |
ready |
awaiting_hello |
session.hello whose payload is invalid (a required member missing, a member of the wrong type, more than 64 features, an unknown protocol syntax) |
Send error (core.invalid_request with data.errors), session.closing (protocol_error); close 4000 |
closed |
awaiting_hello |
session.hello with a bad, expired or revoked token |
Send error (core.unauthenticated or core.token_expired; for a token of a revoked home-session or bot device, 05's auth.session_revoked with data.reason), session.closing (unauthenticated); close 4001 |
closed |
awaiting_hello |
session.hello declaring a protocol below the server's minClient, if the server enforces minClient (§12.4) |
Send error (core.unsupported_version), session.closing (unsupported_version); close 4026 |
closed |
awaiting_hello |
An envelope with v other than 1 |
Send error (core.unsupported_version), session.closing (unsupported_version); close 4026 |
closed |
awaiting_hello |
Any other message | Send error (session.hello_required), session.closing (protocol_error); close 4000 |
closed |
awaiting_hello |
10 s since the handshake without session.hello |
Send session.closing (hello_timeout); close 4008 |
closed |
ready |
session.subscribe, session.unsubscribe, session.ping, session.pong, session.state, session.reauth |
Handle (§5.6 to §5.9, §5.13) | ready |
ready |
The authentication deadline (§5.13) has passed by 60 s with no accepted session.reauth |
Send error (core.token_expired), session.closing (unauthenticated); close 4001 |
closed |
ready |
Another session.hello |
Send error (session.duplicate_hello); otherwise ignore |
ready |
ready |
Any other client message type | Send error (session.unsupported_message); otherwise ignore |
ready |
ready |
No message from the client for 75 s | Send session.closing (idle_timeout); close 4008 |
closed |
ready |
The client session ends (signed out, revoked, expired without renewal, account deleted, device revoked) | Send session.closing (session_ended) with the owner's problem (for example 06's federation.session_ended, or core.token_expired when a remote session simply expired); close 4004 |
closed |
ready |
Another socket of the same client session reaches ready |
Send session.closing (replaced); close 4010 |
closed |
ready |
Outbound queue over its limit (§7.6) | Send session.closing (slow_consumer) if possible; close 4011 |
closed |
ready |
Client exceeds its message rate repeatedly (§7.6) | Send session.closing (rate_limited); close 4029 |
closed |
ready |
Server shutting down or moving the connection | Send session.closing (server_shutdown) with retryAfterMs; close 1012 |
closed |
A socket is bound to the client session that its hello token identified. It stays authenticated only until its authentication deadline: the expiry of the most recent token accepted on it, in session.hello or session.reauth (§5.13). The client extends the deadline in-band, without reconnecting, by sending session.reauth with a fresh token of the same client session after every silent refresh (05) or remote-session renewal (06). Ending the session closes the socket at once, whatever the deadline.
Proposed decision: a socket's authentication lasts until the expiry of the most recent token presented on it, plus 60 s of grace, and the client extends it in-band with session.reauth (§5.13) instead of reconnecting. Rationale: binding a socket to the whole client session would let someone who stole one 15-minute access token (05) keep a live copy of the account's event feed for as long as the session lasts; a thief has no refresh token and so can't send session.reauth. In-band re-authentication keeps that bound without reconnecting every socket every 15 minutes.
Client state machine (per server and account).
| State | Event | Action | Next state |
|---|---|---|---|
idle |
The app needs this server (a context, the community or the account is in use) | Open the socket | connecting |
connecting |
Handshake succeeds with sloppyv.v1 |
Send session.hello with resume positions (§5.4) |
awaiting_ready |
connecting |
Network failure, 429, 5xx, or a failure whose status the client can't read (§5.1 item 5) | Schedule a retry (§5.11). After 3 consecutive failures, re-read /meta and apply versions and minClient (§12.4) |
backoff, or stopped with "update required" |
connecting |
HTTP 400 core.unsupported_version (clients that can read it) |
Re-read /meta and apply 02 §7.4 step 5: show "update required" (update_app) only if every version the server lists is newer than the client's; otherwise treat the server as too old (02's discovery.version_unsupported, shown as 20 says) |
stopped |
awaiting_ready |
session.ready |
Record subscription results; process the stream that follows | ready |
awaiting_ready or ready |
Close 4001 | Recover the token as §3.3 says. Reconnect at once the first time after a successful recovery; after that, with the backoff of §5.11. If recovery fails, follow §3.3 (for the home server, show sign_in) |
connecting, backoff or stopped |
awaiting_ready |
No session.ready within 15 s |
Close with 4008 | backoff |
ready |
Nothing received for 75 s, or the faster in-call check of §5.9 item 6 fails | Close with 4008; reconnect at once | connecting |
ready |
A token for this client session was refreshed or renewed, or the authentication deadline is less than 120 s away | Refresh or renew if needed (05, 06); send session.reauth (§5.13) |
ready |
ready |
Socket closed | Act on the close code (§5.10) | backoff, connecting or stopped |
backoff |
Timer fires, network comes back, or the app returns to the foreground | Open the socket | connecting |
| any | The app no longer needs this server, or the user signs out | Close with 1000 | idle |
5.4 session.hello (client to server)
The first message on every socket. It authenticates the socket and sets up subscriptions in one round trip.
| Member | Type | Required | Meaning and constraints |
|---|---|---|---|
token |
string | Yes | The client-session access token or, at the bot's home server only, a bot token (§3.1 syntax, at most 4,096 characters). Never an S2S token. The server, as the issuer, recognizes which kind of token it is from the token itself (05: bot tokens carry the svb_ prefix); there is no scheme member. |
client |
string | Yes | Product and version, 1 to 128 printable ASCII characters, for example sloppyvoice-desktop/1.0.3. For diagnostics only. |
protocol |
string | No | The protocol version the client implements, major.minor (§12.1). Default "1.0". |
features |
array of string | Yes | The features the client supports (§12.2), at most 64 entries. MAY be empty. Unknown names are ignored. |
resume |
object | No | Map from stream name (§8.3) to the client's position, an integer ≥ 0. Each entry asks for a full subscription that replays everything after that position (§7.4). Position 0 asks for the stream from its start. |
subscribe |
array of string | No | Streams to subscribe at level full from their current head, with no replay. |
heads |
array of string | No | Context references to subscribe at level heads (§5.7). |
foreground |
boolean | No | Initial foreground state (§5.8). Default false. A client with a visible user interface MUST send true when it is visible. |
The me stream is always subscribed at level full, from its current head unless resume names it. A stream named in more than one of resume, subscribe and heads is treated as named only in the first of those three lists, in that order. me in subscribe or heads is ignored. community in heads is refused with core.invalid_request, because only context references may be subscribed at that level. The total number of streams named, apart from me, counts against maxSubscriptions (§16); streams over the limit are refused individually with session.subscription_limit, not the whole hello. The server accepts streams in this order until the limit is reached: resume entries, then subscribe, then heads. Which resume entries are refused when they alone exceed the limit is unspecified, because a JSON object has no order, so clients SHOULD stay within maxSubscriptions.
A session.hello whose payload is invalid (a required member missing or of the wrong type, more than 64 features, or a protocol that doesn't match §12.1) is answered with error core.invalid_request (with data.errors), session.closing (protocol_error) and close 4000 (§5.3).
Rationale for foreground defaulting to false: a client that never reports its state then never suppresses phone pushes (19). A duplicate notification is harmless, because 19 deduplicates by record ID; a missed one isn't.
{
"v": 1,
"t": "session.hello",
"id": "01a2424b-2270-7000-8000-000000000001",
"d": {
"token": "rs_4kJ7yQm2xV0bP9sLwT3e",
"client": "sloppyvoice-desktop/1.0.3",
"protocol": "1.0",
"features": ["voice-dc/1", "video-dc/1", "sfu-rtp/1"],
"resume": { "ch:01938a11-2b3c-7d4e-8f90-112233445566": 4182, "me": 77, "community": 301 },
"subscribe": ["gdm:01a2424b-223e-75c3-8123-456789abcdef"],
"heads": ["ch:01938a11-2b3c-7d4e-8f90-aabbccddeeff"],
"foreground": true
}
}5.5 session.ready (server to client)
The reply to a successful session.hello. It has re set to the hello's id. The server MUST NOT send any envelope other than error and session.closing before session.ready.
| Member | Type | Required | Meaning |
|---|---|---|---|
conn |
string | Yes | UUIDv7 identifying this connection, for diagnostics and support. |
account |
string | Yes | The canonical address of the session's account (01). |
did |
string | Yes | The session's device ID (§8.4). |
server |
string | Yes | The server's canonical domain. |
protocol |
string | Yes | The highest protocol version of the client's major version that the server implements, major.minor. |
features |
array of string | Yes | The effective feature set: the intersection of the server's metadata features and the hello's features (§12.2). |
pingIntervalMs |
integer | Yes | 30000 in this version (§5.9). |
idleTimeoutMs |
integer | Yes | 75000 in this version (§5.9). |
authExpiresAt |
string or null | Yes | The socket's authentication deadline (§5.13): when the hello token expires. null for a token that doesn't expire, such as a bot token without expiresAt (05). |
subscriptions |
array of SubscriptionResult | Yes | One result per stream named in the hello, plus me (§5.6). |
After session.ready the server sends, in this order for each stream: session.resync_required if the stream needs it, then the replayed events, then live events (§7.4). Streams may interleave with each other.
{
"v": 1,
"t": "session.ready",
"id": "01a2424b-2858-73e1-9d1e-5f2a8c7d9e01",
"re": "01a2424b-2270-7000-8000-000000000001",
"ts": "2026-12-04T18:22:31.512Z",
"d": {
"conn": "01a2424b-2914-72a4-bb1c-9f00aa55e7c2",
"account": "bob@a.com",
"did": "q2bS9xVg3m0yJpQe1vT0Aw",
"server": "sloppyvoice.com",
"protocol": "1.0",
"features": ["voice-dc/1", "video-dc/1"],
"pingIntervalMs": 30000,
"idleTimeoutMs": 75000,
"authExpiresAt": "2026-12-04T18:34:02.000Z",
"subscriptions": [
{ "stream": "me", "level": "full", "status": "ok", "headSeq": 79, "replayThrough": 79 },
{ "stream": "ch:01938a11-2b3c-7d4e-8f90-112233445566", "level": "full", "status": "ok", "headSeq": 4190, "replayThrough": 4190 },
{ "stream": "community", "level": "full", "status": "ok", "headSeq": 9120 },
{ "stream": "gdm:01a2424b-223e-75c3-8123-456789abcdef", "level": "full", "status": "refused",
"problem": { "type": "urn:sloppyv:error:core.not_found", "code": "core.not_found", "title": "Not found",
"status": 404, "retryable": false, "userAction": "none" } },
{ "stream": "ch:01938a11-2b3c-7d4e-8f90-aabbccddeeff", "level": "heads", "status": "ok", "headSeq": 88 }
]
}
}In this example the community stream's position 301 is too far behind headSeq 9120, so the server follows session.ready with session.resync_required for community (§7.5) and no replayThrough is given.
5.6 Subscriptions
SubscriptionResult.
| Member | Type | Required | Meaning |
|---|---|---|---|
stream |
string | Yes | The stream name (§8.3). |
level |
string | Yes | full or heads. |
status |
string | Yes | ok or refused. A client treats an unknown value as refused. |
headSeq |
integer | When ok |
The stream's latest seq when the subscription took effect; 0 if the stream has no events yet. |
replayThrough |
integer | No | Present when replay follows: events with seq from the requested position + 1 up to this value are replays. Equal to headSeq. |
problem |
object | When refused |
The problem object (§10.1) explaining the refusal. |
Levels.
full: the socket receives every durable and ephemeral event of the stream.heads: the socket receives onlysession.headsupdates for the stream (§5.7). Only context references may be subscribed at this level.
Who may subscribe. The server checks, for each stream:
me: always allowed.community: allowed when the account may read the community's state, as 09 defines.- a context reference: allowed when the session may read the context's live events, as the owner of that context type defines (09 and 10 for channels, 12 for DMs and group DMs), including the security gates of 00 SM-4.
A refused result carries the problem that the equivalent HTTP read would return, for example security.account_required (which leads to G1) or security.device_not_enrolled (G2). For a context the caller isn't allowed to know about, the problem MUST be core.not_found, never core.forbidden, so that subscriptions don't reveal that a private context exists. A malformed stream name is refused with core.invalid_request. A stream over the subscription limit is refused with session.subscription_limit.
Continuous authorization. The server re-evaluates authorization whenever the session's right to read a subscribed stream may have changed: kick, ban, leaving, a move to needs_encryption, a permission change, deletion of the context, device revocation, or the end of the client session. When the right is lost, the server stops delivering that stream before it delivers any later event of it, and sends session.subscription_ended. If the owner says so, the durable event that records the change (for example the member's own removal) MAY be the last event delivered on that stream.
session.subscribe (client to server). Adds or changes subscriptions after session.ready.
| Member | Type | Required | Meaning |
|---|---|---|---|
resume |
object | No | As in session.hello. |
subscribe |
array of string | No | As in session.hello. |
heads |
array of string | No | As in session.hello. |
At least one member MUST be non-empty. A session.subscribe or session.unsubscribe whose payload is invalid (no non-empty member, or a member of the wrong type) is answered with a non-fatal error core.invalid_request (with data.errors, re set) and otherwise ignored. Effects:
- A
resumeentry for a stream that is already subscribed restarts it from the given position, with replay. Clients use this to repair a gap (§7.3). - A
subscribeentry for a stream already atfullchanges nothing and returnsokwith the currentheadSeq. - Naming a
headsstream inresumeorsubscribeupgrades it tofull. Naming afullstream inheadsdowngrades it toheads.
The server answers with session.subscribed (re set), whose d is {"subscriptions": [SubscriptionResult, …]} with one result per stream named, in any order. Replays and session.resync_required for the new subscriptions follow it, as after session.ready.
session.unsubscribe (client to server). d is {"streams": [stream, …]}, at least one entry. Streams that aren't subscribed, and me, are ignored. The server answers with session.unsubscribed (re set), whose d is {"streams": [...]} listing the streams it removed. The server MUST NOT send any event of a removed stream after session.unsubscribed.
session.subscription_ended (server to client). The server ended a subscription on its own. d:
| Member | Type | Required | Meaning |
|---|---|---|---|
stream |
string | Yes | The stream. |
problem |
object | Yes | Why, as a problem object: for example core.forbidden (permission removed), core.gone (context deleted), security.account_required (the context became secure and the account is insecure, so the membership is now needs_encryption), or an owner's code. |
The client removes the stream from its subscription set and from its next resume. It shows the problem's userAction when the user is looking at that context (for example G1). It MAY subscribe again later, for example after turning on encryption.
{
"v": 1,
"t": "session.subscription_ended",
"id": "01a2424b-9d88-7111-a222-333344445555",
"ts": "2026-12-04T18:23:01.512Z",
"d": {
"stream": "ch:01938a11-2b3c-7d4e-8f90-112233445566",
"problem": {
"type": "urn:sloppyv:error:security.account_required",
"code": "security.account_required",
"title": "This channel is end-to-end encrypted",
"status": 403,
"retryable": false,
"userAction": "enable_encryption",
"data": { "ctx": "ch:01938a11-2b3c-7d4e-8f90-112233445566" }
}
}
}Proposed decision: subscriptions are explicit and have two levels, full and heads, with me always subscribed. Rationale: a client follows the handful of contexts the user is looking at in full, and keeps cheap unread indicators for the rest, without the server pushing every event of a large community to every member.
5.7 session.heads (server to client)
Gives the latest position of streams subscribed at level heads, so a client can show unread indicators without receiving their events. It is a control message: it has no seq, isn't replayed, and the server merges pending updates under backpressure (§7.6).
| Member | Type | Required | Meaning |
|---|---|---|---|
heads |
object | Yes | Map from context reference to a Head object. |
Head object:
| Member | Type | Required | Meaning |
|---|---|---|---|
headSeq |
integer | Yes | The stream's latest seq. |
lastItemSeq |
integer | No | The seq of the latest durable event in the stream that is a timeline item (§11.2) and that this socket's account would receive with its full payload. Withheld events (§7.2 D4a) don't count, so a member never sees an unread indicator for something it can't read. Absent if there is none. |
lastItemAt |
string | No | That event's ts. |
The server sends one session.heads covering every new heads subscription right after session.ready or session.subscribed. After that it sends an update when a heads stream's lastItemSeq changes, coalescing updates so that it sends at most one session.heads per socket every 2 s, each listing only the streams that changed. A client compares lastItemSeq with its read position (11) to show an unread indicator. Mention counts are not part of this message; mention notifications come through 19.
{
"v": 1,
"t": "session.heads",
"id": "01a2424b-9d88-7111-a222-333344445556",
"ts": "2026-12-04T18:23:01.512Z",
"d": { "heads": { "ch:01938a11-2b3c-7d4e-8f90-aabbccddeeff": { "headSeq": 90, "lastItemSeq": 90, "lastItemAt": "2026-12-04T18:23:01.104Z" } } }
}5.8 session.state (client to server)
Tells the server whether the user can currently see the app.
| Member | Type | Required | Meaning |
|---|---|---|---|
foreground |
boolean | Yes | true when the user can see the app (window or tab visible, mobile app in front); false otherwise. |
A client SHOULD send foreground: false when the app goes to the background, all its windows are hidden or minimized, or its browser tab is hidden, and foreground: true when it becomes visible again. It sends at most one session.state with foreground: true per 5 s, and a server MAY ignore a change to foreground: true that arrives faster. A client MAY send foreground: false at any time, for example just before the operating system suspends it, and a server MUST apply it at once (19 §4.3). There is no reply. A closed socket is never a foreground session.
Proposed decision: clients declare foreground state with session.state, and "foreground session" (§1.3) is defined from it. Rationale: 19 sends message notifications only for recipients without an attentive session on the hosting server (00 HP-9, 19 §4.3). A desktop app that stays connected while minimized must still get pushes, so "connected" alone isn't enough.
5.9 Heartbeat
- The server sends
session.ping(dis{}) every 30 s (pingIntervalMs) on everyreadysocket, whatever other traffic flows. It MAY add up to 1 s of random jitter. - The client answers each
session.pingat once withsession.pong, withreset to the ping'sidandd{}. - The server closes a socket from which it has received no message for 75 s (
idleTimeoutMs), with 4008. - A client that has received no message for 75 s considers the connection dead, closes it with 4008 and reconnects at once (§5.11).
- A client MAY send its own
session.pingat any time, for example after the device wakes up or the network changes, but not more than once per 5 s. The server answers withsession.pong(reset). A client that gets nosession.pongwithin 10 s SHOULD treat the connection as dead. - During a call. While a client participates in a call hosted on this server, it sends
session.pingwhenever it has received nocall.tick(15) on the socket for 3 s, at most once per 3 s (this overrides the 5 s spacing of item 5), and treats a missingsession.pongafter 3 s as a dead connection (§5.11). The WebSocket copy of the lease tick is the hosting server's own channel to the client, which reaches it even when its relay connection is down and lets it recover from a relay that withholds or wedges ticks (15 §4.4, D-046), so a half-open socket must not go unnoticed for 75 s.
Rationale: 30 s keeps NAT and proxy mappings alive. 75 s is two missed pings plus margin, so a single delayed ping doesn't drop a healthy connection.
5.10 session.closing and close codes
Before closing a socket on purpose, the server SHOULD send session.closing and then close within 1 s.
| Member | Type | Required | Meaning |
|---|---|---|---|
reason |
string | Yes | One of the reasons in the table below. A client treats an unknown value by following reconnect and retryAfterMs. |
reconnect |
boolean | Yes | Whether the client should reconnect automatically. |
retryAfterMs |
integer | No | The minimum delay before reconnecting. |
problem |
object | No | A problem object, for session_ended, unauthenticated, unsupported_version and rate_limited. |
Precedence. For a close code in the table below, the table decides the client's action, and reconnect and retryAfterMs only refine it (for example by setting the delay). For an unknown reason or an unknown close code, the client follows reconnect and retryAfterMs, and without them reconnects with backoff. A client ignores the close code and session.closing of a socket it has already replaced or abandoned (for example after opening a new socket on a network change).
| Close code | reason |
Meaning | Client action |
|---|---|---|---|
| 1000 | — | Normal closure by the client | — |
| 1001 | — | Going away (either side) | Reconnect with backoff if still needed. |
| 1002, 1003, 1007 | — | WebSocket protocol violation, binary message, invalid UTF-8 | Reconnect with backoff; record a diagnostic. |
| 1009 | too_large |
A message exceeded maxEventBytes |
Reconnect with backoff; record a diagnostic. |
| 1011 | — | Internal server error | Reconnect with backoff. |
| 1012 | server_shutdown |
Service restart or connection moved | Reconnect after retryAfterMs, or after a random delay of 1 to 10 s if none was given. |
| 1013 | — | Try again later | Reconnect after retryAfterMs, or with backoff of at least 5 s. |
| 4000 | protocol_error |
Invalid envelope or session.hello payload, message before hello |
Reconnect with backoff; record a diagnostic. |
| 4001 | unauthenticated |
Token invalid, expired or revoked at hello, or the authentication deadline passed without session.reauth (§5.13) |
Recover the token (§3.3), then reconnect: at once the first time after a successful recovery, otherwise with backoff (§5.3). |
| 4004 | session_ended |
The client session ended. The problem carries the owner's code, for example 06's federation.session_ended, or core.token_expired when a remote session expired. |
Don't reuse the token, even if the problem is core.token_expired: the session no longer exists. Follow the problem's userAction; for remote sessions, create a new remote session silently first (§3.3, 06). Owner events about the same ending that arrived just before (for example federation.session_ended) are informational. |
| 4008 | hello_timeout, idle_timeout |
No hello within 10 s, or no message for 75 s | Reconnect at once, then with backoff. |
| 4010 | replaced |
A newer socket of the same client session took over | As §5.12 item 3: reconnect silently once only if the client knows no other instance of itself is running; otherwise don't reconnect automatically. |
| 4011 | slow_consumer |
The client couldn't keep up (§7.6) | Reconnect with backoff of at least 1 s; SHOULD move streams the user isn't viewing to heads, but never the context of a call it participates in (§7.6). |
| 4026 | unsupported_version |
Client protocol below minClient, or a client envelope with an unknown v |
Stop; show "update required" (update_app). |
| 4029 | rate_limited |
Too many client messages or connections | Reconnect after retryAfterMs, or 60 s if none was given. |
A client closes with 1000, 1001 or 4008, or with the protocol-violation codes that §5.1, §5.2 and §6.1 require (1002, 1003, 1007, 1009 and 4000; see §5.2 item 6 for browsers). The WebSocket close reason text, if any, is the reason value and has no other meaning.
When a server restarts, it SHOULD give each socket a different retryAfterMs, spread uniformly over 0 to 30 s, so clients don't all reconnect at once. Sockets of sessions that participate in a call SHOULD get a retryAfterMs of at most 2 s, and such a client caps its own reconnect delay after server_shutdown at 2 s, so that the WebSocket copy of the lease tick (15) is restored quickly.
5.11 Reconnecting
- Retry
n(starting atn = 0) waits a uniformly random delay in[0, min(30 s, 1 s × 2^n)], but never less than the minimum the close code orretryAfterMssets. nresets to 0 when a socket has stayed inreadyfor 60 s. It doesn't reset atsession.ready, so a server that accepts and then closes at once can't cause a tight loop.- When the operating system reports that the network came back, or the app returns to the foreground, the client reconnects at once (counting as
n = 0), but not more than once per 5 s. - Every reconnect sends a
session.hellowhoseresumelists the client's position (§7.3) for every stream it had at levelfull, and whoseheadslists itsheadsstreams. This restores the whole subscription set in one round trip. - User experience. Reconnecting is silent (00 §4.12.5). A client MAY show a small "Reconnecting…" status line, but only after 5 s without a
readysocket, and MUST NOT show a dialog or prompt. Messages the user sends meanwhile wait in the outbox (11), which uses HTTP and is independent of the socket. This rule governs only the connection status. It never delays or suppresses the talk and mute indicators of D-012 and 00 HP-13 (15, 16, 20): whenever the client can't transmit while push-to-talk is held, for any reason including a lost socket, the talk indicator says at once that the user isn't being heard.
5.12 One socket per client session
- A client MUST NOT open more than one event WebSocket per client session (00 §7.4, D-026). A client that uses several servers has one socket per server. A client signed in to two accounts on the same server has one socket per account, because those are two client sessions.
- When a socket's
session.helloauthenticates a client session that already has areadysocket, the server completes the new socket and then closes the old one withsession.closing(replaced) and 4010. The newest socket wins. - A client that receives 4010 on its current socket reconnects silently once, but only if it knows locally that no other instance of itself is running for this client session: on the web it holds the Web Locks lock or SharedWorker leadership of item 4; on desktop and mobile it holds a single-instance process lock. If it can't tell, or if it is replaced again within 60 s of that reconnect, it MUST NOT reconnect automatically: it records a diagnostic and, if the app is still open and needs the socket, shows a quiet notice such as "Sloppy Voice is open in another window" with a button to use this window, which reconnects.
- A web client that may run in several tabs MUST share one socket per client session across tabs, for example through a SharedWorker or a leader elected with the Web Locks API, so that tabs never replace each other.
00 §7.4 and D-026 say at most one WebSocket per client session per server.
Rationale: newest-wins means a socket left half-open by a network change never blocks the reconnect, and the explicit "replaced" closure stops two copies of the app from fighting. The single silent reconnect means a socket opened by someone holding a stolen access token can't keep the real app disconnected behind a reassuring notice, while two real copies of the app still stop after one round.
5.13 session.reauth (client to server)
Extends the socket's authentication deadline (§5.3) without reconnecting.
| Member | Type | Required | Meaning |
|---|---|---|---|
token |
string | Yes | A currently valid token of the same client session (§3.1 syntax), typically the access token a silent refresh (05) or a remote-session renewal (06) just produced. |
- The authentication deadline of a socket is the expiry of the most recent token accepted on it, as its issuer knows it (an issuer that extends a token's life, as 06 does for a remote session it extends, moves the deadline with it). It is
nullfor a token that doesn't expire.session.readyreports it inauthExpiresAt. - On a valid token of the same client session, the server sets the new deadline and answers
session.reauthed(reset) withd{"authExpiresAt": string or null}. - On a token that is invalid or expired, the server answers
error(core.unauthenticatedorcore.token_expired; for a token of a revoked home-session or bot device, 05'sauth.session_revokedwithdata.reason;reset) and keeps the current deadline. On a valid token of a different client session, it answerserror(session.wrong_session,reset) and keeps the current deadline. Neither error closes the socket by itself. - When the deadline has passed by 60 s and no
session.reauthhas been accepted, the server sendserror(core.token_expired),session.closing(unauthenticated) and closes with 4001 (§5.3). Ending the client session closes the socket at once with 4004, whatever the deadline. - A client sends
session.reauthon a server's socket after every refresh or renewal of that client session's token, and refreshes or renews (05, 06) when the deadline is less than 120 s away even if it made no HTTP request meanwhile.session.reauthcounts toward thesocketrate limit (§15).
{ "v": 1, "t": "session.reauth", "id": "01a2425c-1d00-7a10-8b20-3c4d5e6f7a80",
"d": { "token": "sva_9pQm2xV0bP9sLwT3eRkW" } }{ "v": 1, "t": "session.reauthed", "id": "01a2425c-1d40-7c11-9d22-4e5f60718293",
"re": "01a2425c-1d00-7a10-8b20-3c4d5e6f7a80", "ts": "2026-12-04T18:32:40.115Z",
"d": { "authExpiresAt": "2026-12-04T18:47:40.000Z" } }6. The envelope
6.1 Members
Every WebSocket message in either direction is one envelope.
| Member | Type | Server to client | Client to server | Meaning and constraints |
|---|---|---|---|---|
v |
integer | Required | Required | Envelope version. MUST be 1 on the sloppyv.v1 subprotocol. |
t |
string | Required | Required | Message or event type, <area>.<name> (§11.1), or the reserved type error. |
id |
string | Required | Required | UUIDv7 (§8.2) of this envelope. For a durable event it is fixed when the event is sequenced and is the same in every delivery and replay. For every other envelope it is fresh. |
re |
string | Only on replies | Only on session.pong |
The id of the message being answered. |
ctx |
string | On every event; absent on control messages | Absent; ignored if present | The stream the event belongs to (§8.3): a context reference, me or community. |
seq |
integer | On durable events only | Absent; ignored if present | The event's sequence number in the stream ctx names (§7). Integer from 1 to 2^53 − 1. |
ts |
string | Required | Optional; ignored | Server timestamp (§9). For a durable event, the time it was sequenced, the same in every delivery. Otherwise, when the server created the envelope. |
d |
object | Required | Required | The payload, defined by the owner of t. {} when there is nothing to carry. |
Member order is not significant. Receivers ignore unknown envelope members (§2.4). A server that receives a client envelope with v other than 1 answers error with core.unsupported_version, sends session.closing (unsupported_version) and closes with 4026, so an outdated client stops instead of looping. A client that receives a server envelope with v other than 1 drops it, closes with 4000 and reconnects with backoff.
The member name ctx is kept from 00 §7.4 although its value may be me or community, which aren't context references.
A durable event, an ephemeral event and a control message:
{
"v": 1,
"t": "message.created",
"id": "01938f2e-7c1a-7b3e-9d1e-5f2a8c7d9e01",
"ctx": "ch:01938a11-2b3c-7d4e-8f90-112233445566",
"seq": 4182,
"ts": "2026-12-04T18:22:31.512Z",
"d": {
"mid": "01938f30-1b2c-7d4e-8f90-a1b2c3d4e5f6",
"sender": { "addr": "alice@a.com", "name": "Alice", "did": "q2bS9xVg3m0yJpQe1vT0Aw" },
"content": { "text": "Hello", "replyTo": null, "attachments": [] }
}
}(d is abbreviated; 11 §5.2 defines the full Message object.)
{ "v": 1, "t": "typing.started", "id": "01a2424b-2914-72a4-bb1c-9f00aa55e7c3",
"ctx": "ch:01938a11-2b3c-7d4e-8f90-112233445566", "ts": "2026-12-04T18:22:31.700Z",
"d": { "addr": "alice@a.com" } }{ "v": 1, "t": "session.ping", "id": "01a2424b-9d88-7111-a222-333344445557",
"ts": "2026-12-04T18:23:01.512Z", "d": {} }The payload of message.created is owned by 11 and the type typing.started is shown only as an illustration of an ephemeral event; 11 owns the actual typing event names.
6.2 Client messages
Apart from the session.* messages in the table below, the socket is server-to-client only (00 §7.4). Every command goes over HTTPS.
| Type | Purpose | Reply |
|---|---|---|
session.hello |
Authenticate and subscribe (§5.4) | session.ready or error |
session.subscribe |
Add or change subscriptions (§5.6) | session.subscribed |
session.unsubscribe |
Remove subscriptions (§5.6) | session.unsubscribed |
session.state |
Foreground state (§5.8) | None |
session.reauth |
Extend the authentication deadline (§5.13) | session.reauthed or error |
session.ping |
Liveness check (§5.9) | session.pong |
session.pong |
Answer to the server's session.ping (§5.9) |
None |
Any other type sent by a client is answered with error (session.unsupported_message) and otherwise ignored. No owner may add a client-to-server message type outside the session area; adding one in it requires a change to this document.
6.3 Errors on the WebSocket
A WebSocket error is an envelope with t: "error" and the problem object (§10.1) in d. It has re when it answers a client message, and no ctx or seq. The status member holds the HTTP status that the same condition has over HTTP (or the status §10.6 gives for session.* codes). Problems about one stream within a subscription request go in that stream's SubscriptionResult, not in an error. An error that ends the connection is followed by session.closing and a close code (§5.10).
{
"v": 1,
"t": "error",
"id": "01a2424b-9d88-7111-a222-333344445558",
"re": "01a2424b-2270-7000-8000-000000000009",
"ts": "2026-12-04T18:23:01.512Z",
"d": {
"type": "urn:sloppyv:error:core.rate_limited",
"code": "core.rate_limited",
"title": "Too many requests",
"status": 429,
"retryable": true,
"retryAfterMs": 4000,
"userAction": "wait",
"data": { "policy": "socket" }
}
}7. Sequencing, durable and ephemeral events, and resume
7.1 Streams
| Stream | Name in ctx |
Where it lives | What it carries (the owners decide exactly) |
|---|---|---|---|
| Context stream | The context reference | The context's hosting server | Timeline items, the context's membership and settings, MLS handshakes (11, 09, 12, 13, 14) |
| Account stream | me |
One per account per server, on every server where the account has a client session or a record (lifetime below) | At the home server: DM index and message requests (12), account and device changes (05), identity changes (07). At every server: read state and presence (11), metadata-change hints (02). At a remote or hosting server, additionally: the account's own membership, moderation, invites, reports and role events there (09, 10), identity refresh hints for DMs it hosts (07), notify.triggered (19) and remote-session endings (06). §11.3 lists every me event. |
| Community stream | community |
Every server, one each | Community settings, the channel list, roles and community membership (09, 10) |
Every server has one durable community stream, named community in ctx (D-078, 00 §7.4). Owners put events that every community member receives on community, not copied into each member's me stream; events for one account or a few accounts go on those accounts' me streams.
Lifetime of an account stream. A server creates an account's me stream when the account first has a client session there, or earlier when the server first records something about the account (a membership, a ban, a pending request, a DM participation or, at the home server, the account itself). It keeps the stream, with its seq counter, for as long as it holds any such record about the account, independently of individual client sessions: a remote session that ends and a new one created hours later continue the same stream. Durable me events are sequenced whether or not the account is connected, and are retained under the replay window of §7.4. A me stream never restarts at 1 while it exists. If a server deletes one and later recreates it, it answers any resume of it with session.resync_required (server_reset).
Each stream has its own seq counter. There is no ordering between streams: a client MUST NOT assume that an event in one stream happened before or after an event in another stream with a lower or higher seq or ts. Ordering within a context always uses seq, never an ID or a timestamp (00 §7.6).
7.2 Event classes
The owner of each event type declares its class in its own registry entry (§11.2). There are three classes:
Durable events. A server MUST ensure:
- D1. Each durable event belongs to exactly one stream and has a
seqequal to the previous event'sseqin that stream plus 1. The first event of a stream hasseq1. Aseqis never skipped, reused or reassigned. - D2. The
seqis assigned in the same atomic step as the state change the event reports. An event is never delivered before its change is committed, and a deliveredseqis never rolled back. - D3. Every socket with a
fullsubscription to the stream receives every durable event of the stream from its subscription point on, inseqorder. - D4. Every subscriber receives every
seq. A server MUST NOT skip aseqfor some subscribers, and MUST NOT omit the envelope of a durable event for a subscriber who may not see it. Where an owner needs a payload that depends on the viewer, it defines a reduced payload for viewers who aren't entitled to the full one, and the envelope with itsseqis still delivered. - D4a. Withheld form. Where a subscriber may see nothing of a durable event's payload and the owner defines no other reduced payload, the server delivers the envelope with the same
t,ctx,seq,idandtsanddset to{"withheld": true}. An owner MAY add members to a withheld payload that identify the affected object (for example 11'starget), but nothing that the viewer isn't entitled to. The member namewithheldis reserved in every durable payload for this meaning. A client that receiveswithheld: trueadvances its positionPpast the event (§7.3) and does nothing else. A withheld event is replayed in the same form to that viewer, is never shown as a timeline item, and doesn't count toward that viewer'slastItemSeq(§5.7). - D5. The
idandtsare fixed when the event is sequenced and are the same in every delivery and replay. - D6. Events are retained for replay as §7.4 requires.
- D7. On replay, the server MAY replace the payload with the owner's tombstone form when the content has since been deleted, moderated or expired (10, 11).
t,seq,idandtsstay the same. - D8. Applying a durable event to state that already reflects it changes nothing. Owners MUST design durable payloads to be idempotent, for example by carrying the object's ID with its full new state or a version number.
Ephemeral events.
- E1. They carry no
seq, are never replayed and are delivered at most once. - E2. An untargeted ephemeral event is delivered only to sockets with a
fullsubscription to its stream. A targeted one is delivered as E5 says. - E3. Servers MAY coalesce or drop them under backpressure (§7.6).
- E4. No owner may make an ephemeral event the only way a client can learn state it needs after reconnecting. The owner either provides an HTTP read of the current state (for example the participants of a call, 15) or uses a durable event.
- E5. An owner MAY target an ephemeral event at particular client sessions or devices, for example
mls.commit_neededto the designated committer (13),mls.welcometo a device just added to a group (13), orcall.ringingto every session of a called account (15). A targeted event is delivered to everyreadysocket of each targeted session on this server, whatever that socket's subscription level for the event's stream, and itsctxstill names the stream it concerns. It is dropped only for targeted sessions that aren't connected. Durable per-device data is never carried by a targeted event alone; the owner provides an HTTP read (E4).
Control messages are the session.* messages and error (§5, §6.3). They carry no seq and are never replayed.
Guidance for owners (informative): durable for anything a client caches as persistent state (timeline items, edits, deletions, reactions, membership, roles, settings, MLS handshakes, the DM index); ephemeral for transient signals (typing, presence, lease ticks, call state, prompts to act now such as mls.commit_needed, and pairing relay messages).
Rationale: gap-free sequences make "did I miss anything?" a single integer comparison per stream, and D4 keeps it that way even when some viewers see less. D8 lets a client apply events over a freshly fetched snapshot without working out exactly where the snapshot ends.
7.3 Client processing rules
A client keeps a position P for each stream it follows at level full: the seq of the last durable event it has applied. Positions are kept per (server canonical domain, account, stream).
- On a fresh subscription (
subscribe, no replay),Pis the result'sheadSeq. - For each durable event
eof streams:- if
e.seq ≤ P, it is a duplicate: ignore it; - if
e.seq = P + 1, apply it, then setP = e.seq. An event of an unknown type is applied by ignoring its payload, and still advancesP; - if
e.seq > P + 1, there is a gap, which an honest server never causes: don't apply it, drop further events ofsuntil the repair completes, and sendsession.subscribewithresume: {s: P}. The repair completes when the client receives the SubscriptionResult forsinsession.subscribed(or asession.resync_requiredfors); from then on this rule applies normally to the replay and live events that follow. - If gaps happen 3 times for the same stream within 5 minutes, the client records a diagnostic and resyncs the stream itself: it marks
sas resyncing and queues its events (§7.5 step 1), sendssession.subscribewithsubscribe: [s](which, for a stream already atfull, returns the currentheadSeqwithout replay, §5.6), and runs §7.5 steps 1 to 4 with thatheadSeq.
- if
- Ephemeral events never change
P. Unknown ephemeral types are ignored. - A client MUST store
Patomically with the state it derived from events up toP. If it can't, it MUST store a value no greater than what it has durably applied. A client that has lost its cached state for a stream but still hasPMUST NOT resume fromP; it subscribes fresh and refetches the state over HTTP. - Positions are discarded when the user signs out of that account, when the account is deleted, and when a resync replaces them.
- HTTP responses never advance
P(§2.8).
7.4 Resume and replay
For each resume entry (stream s, position P) the server compares P with the stream's head H:
| Condition | Result |
|---|---|
| Not authorized | refused with the problem (§5.6). |
P = H |
ok. No replay. Live events follow from H + 1. |
P < H, H − P ≤ maxReplayEvents, every event from P + 1 to H is retained, and the account's read access to s didn't lapse at any point after P was sequenced |
ok with replayThrough: H. Events P + 1 to H are replayed in order, then live events follow. |
P < H, too many events |
ok, then session.resync_required with reason gap_too_large. |
P < H, events no longer retained |
ok, then session.resync_required with reason expired. |
P < H, read access lapsed and was regained after P |
ok, then session.resync_required with reason access_changed. |
P > H |
ok, then session.resync_required with reason ahead. |
Replay window. A server MUST be able to replay any gap of up to maxReplayEvents events (default 5,000, floor 1,000) whose oldest event was sequenced less than 24 h ago. It MAY replay larger or older gaps.
Order. Within a stream, replayed events come in seq order and before any live event of that stream. Live events that occur during the replay are queued and follow it. Different streams may interleave freely. A server MAY pace replay to the socket's drain rate (§7.6).
Access lapses. A server MUST NOT replay events that were sequenced while the account had no read access to the stream, because that could reveal messages sent while the person wasn't a member. Where it can't tell, it sends session.resync_required with reason access_changed.
The server keeps no per-session acknowledgement state; the client's resume positions are the only record of what it has seen.
7.5 session.resync_required and refetching state
The server sends session.resync_required when it can't bring a stream up to date by replay. It MAY send it at any time, not only after subscribing, for example after losing an internal buffer (§7.6).
| Member | Type | Required | Meaning |
|---|---|---|---|
stream |
string | Yes | The stream. |
reason |
string | Yes | gap_too_large, expired, ahead, access_changed, buffer_overflow or server_reset. A client treats an unknown value like gap_too_large. |
headSeq |
integer | Yes | The stream's head when the message was sent. Live events of the stream continue from headSeq + 1. |
{
"v": 1,
"t": "session.resync_required",
"id": "01a2424b-2914-72a4-bb1c-9f00aa55e7c4",
"ts": "2026-12-04T18:22:31.700Z",
"d": { "stream": "community", "reason": "gap_too_large", "headSeq": 9120 }
}Client procedure.
- Mark the stream as resyncing. Queue its live events (those with
seq > headSeq) in order; don't apply them yet. - Refetch the state the client caches for the stream through the owners' HTTP endpoints: for a context, its latest timeline page (11, §13.1), membership and settings (09, 12); for
community, the community, channel list and roles (09, 10); forme, the account, devices and DM index (05, 12). For a secure context, the client continues MLS processing from its current epoch, catching up from the hosting server's handshake log (13); it uses a resync external commit only when 13's own conditions for one hold, never merely because of this message. - Process the queued events in
seqorder. The client MAY skip queued events whoseseqis not greater than the lowestheadSeqamong the owner responses it fetched in step 2 (§13.1), because those are already in the snapshot; it applies all the others. Where no response reported aheadSeq, it applies them all. D8 makes re-applying an event already in the snapshot harmless. - Set
Pto the greater of the resyncheadSeqand the highest queuedseqit processed or skipped, then clear the mark. Live events fromP + 1on are then handled by §7.3 rule 2; one that is already reflected in a snapshot is harmless to apply (D8). AheadSeqfrom an HTTP response never setsP(§2.8).
What a resync discards. "Cached state" in this section means only state the client derived from the stream's events: the timeline cache, membership, settings and the like. A resync of any reason MUST NOT by itself make a client discard MLS group state, history keys (K_hist, 14), identity pins or AccountVault data (08). With reason ahead or server_reset, the client MUST discard its event-derived cached state for the stream before step 2, because the server no longer has, or has renumbered, events the client saw, and SHOULD record a diagnostic. In a secure context the client also reports an ahead or server_reset resync to the hosting server through /v1/diagnostics with report kind transport (15 §14.4) and data {"event": "resync", "reason": <reason>, "stream": <stream>}, because an honest server never loses events a client has seen.
User experience. A resync is silent (00 §4.12.5). In a timeline, the client shows the latest page at once and loads older messages when the user scrolls back. It never shows a prompt, and it shows a "Loading…" placeholder only where content is actually missing.
7.6 Backpressure and slow consumers
Server.
- Each socket has its own outbound queue. A slow socket MUST NOT delay sequencing, other sockets, or HTTP responses (per-recipient delivery, as the relay does for media).
- The queue limit is the larger of 4 MiB and 4 ×
maxEventBytes. The age limit is 30 s for the oldest queued durable event. - When a socket's queue passes its limit, the server first coalesces ephemeral events (keeping only the newest
call.tickper call, the newest typing event per context and person, the newest presence event per account, and mergingsession.heads), then drops the remaining queued ephemeral events. Apart from this, a server drops a queued ephemeral event only under its owner's own staleness rule (for example 15 §4.4 discards acall.tickthat has waited more than 250 ms). - If the queue is still over its limit, or the age limit is exceeded, the server either (a) sends
session.closing(slow_consumer) and closes with 4011, or (b) for one or more streams, drops that stream's queued durable events and sendssession.resync_requiredwith reasonbuffer_overflow. A server MUST NOT drop a durable event in any other way. - Replayed events count toward the queue. Servers pace replay so that it doesn't trigger slow-consumer handling by itself.
Client.
- A client MUST keep reading from the socket while it processes events, queuing them internally, so that the server sees the real drain rate.
- After a 4011 closure, the client reconnects with backoff of at least 1 s and SHOULD move streams the user isn't viewing to level
heads. - A client MUST keep a
fullsubscription to the context of any call it participates in, and MUST NOT move that context toheads, under slow-consumer recovery or otherwise, while the call lasts. Call-state events go to the context's full subscribers (15).
Client-to-server rate. A server MUST accept at least 20 client messages per socket per 10 s. Beyond its limit it answers error (core.rate_limited, with retryAfterMs). After 3 such errors within 60 s it MAY close with 4029. session.pong answers to the server's own pings never count toward the limit.
8. Identifiers
This section makes the identifier table of 00 §7.6 normative and gives a grammar for each identifier. The grammars use RFC 7405 %s"…" for case-sensitive literals; plain ABNF quoted strings are case-insensitive.
8.1 General rules
- Identifiers are compared as exact byte strings after validation. No case folding, trimming or Unicode normalization is applied when comparing, except to addresses, which are compared in canonical form (01).
- Every identifier has exactly one valid spelling. A server MUST reject an identifier in a non-canonical spelling (uppercase hex in a UUID, non-canonical base64url, a leading zero in a decimal) with 400
core.invalid_request, in a body, a query or a path. It MUST NOT silently convert it. Addresses and address local parts are excepted: where 01 accepts other input forms (for example{local}path parameters and address lookups on the server that owns the domain, 00 HP-8), they are canonicalized as 01 says, and a non-canonical address where a canonical one is required is rejected with 01's codeaddress.non_canonical. Stored and signed objects still contain canonical addresses only (D-032). - Identifiers are opaque except where this section or the owner gives them structure. Clients MUST NOT parse the time out of a UUIDv7 for any purpose other than diagnostics.
- Ordering inside a context always uses
seq, never an ID (00 §7.6).
8.2 UUIDv7
uuid7 = 8LHEX "-" 4LHEX "-" %x37 3LHEX "-" uuid-var 3LHEX "-" 12LHEX
uuid-var = %x38 / %x39 / %x61 / %x62 ; "8" / "9" / "a" / "b"
LHEX = DIGIT / %x61-66 ; lowercase hexadecimal only- UUIDv7 values follow RFC 9562 §5.7: a 48-bit big-endian Unix time in milliseconds, the version 7, 12 bits
rand_a, the variant10, and 62 bitsrand_b. They are written lowercase and hyphenated, 36 characters. - A generator MUST fill
rand_bfrom a cryptographically secure random generator. It MAY userand_aas a monotonic counter (RFC 9562 §6.2, Method 1) or fill it randomly. - The binary form of a UUID is its 16 bytes in the order of the hexadecimal string, as RFC 9562 §4 defines. Wherever another document uses an ID in binary, for example the
midinK_msg(14), it uses this form. - Client-generated IDs. A client generates the
midof each message (00 §7.6) and any other ID an owner says is client-generated, such as theshareIdof a HistoryShare (14 §7.4). These IDs are idempotency keys (§14.1). A server MUST NOT reject a client-generated ID because of its embedded time: an outbox may hold an ID for days, and device clocks are often wrong. - Server-generated IDs are used for every other object: channels, roles, invites, reports, calls, notification records, envelope
ids, connections, pairing sessions and so on (00 §7.6).
8.3 Context references and stream names
ctx-ref = channel-ref / dm-ref / gdm-ref
channel-ref = %s"ch:" uuid7
dm-ref = %s"dm:" b64u-128
gdm-ref = %s"gdm:" uuid7
stream = ctx-ref / %s"me" / %s"community"ch:references are generated by the hosting server when it creates the channel (09).dm:references are computed by anyone from the two participants' canonical addresses (12, HP-9). They are 16 bytes in canonical base64url.gdm:references are generated by the hosting server when it creates the group DM (12).meandcommunityare stream names (§7.1). They are never context references and never appear in a{ctx}path parameter.
8.4 Other identifiers
b64u-char = ALPHA / DIGIT / "-" / "_"
b64u-last2 = %x41 / %x45 / %x49 / %x4D / %x51 / %x55 / %x59 / %x63
/ %x67 / %x6B / %x6F / %x73 / %x77 / %x30 / %x34 / %x38
; AEIMQUYcgkosw048: 2 unused bits are zero
b64u-last4 = %x41 / %x51 / %x67 / %x77
; AQgw: 4 unused bits are zero
b64u-64 = 10b64u-char b64u-last2 ; 8 bytes, 11 characters
b64u-128 = 21b64u-char b64u-last4 ; 16 bytes, 22 characters
b64u-256 = 42b64u-char b64u-last2 ; 32 bytes, 43 characters
did = b64u-128
jti = 22*86b64u-char ; at least 128 bits, at most 64 bytes
key-thumbprint = b64u-256 ; ikf, dkf
server-kid = canonical-domain "#" key-id
key-id = 1*32( ALPHA / DIGIT / "." / "_" / "-" )
canonical-domain = <a lowercase A-label domain, as 01 and 02 define>
mls-group-id = %s"sv1:" canonical-domain ":" ctx-ref ":" generation
generation = "0" / ( %x31-39 *15DIGIT )
idempotency-key = 1*64( ALPHA / DIGIT / "-" / "." / "_" / "~" )
cursor = 1*512( ALPHA / DIGIT / "-" / "." / "_" / "~" )
problem-instance = %s"urn:uuid:" uuid7
LCALPHA = %x61-7AA jti MUST also be canonical base64url: its final character carries only the bits that RFC 4648 §3.5 allows for its length.
| Identifier | Format | Wire type | Generated by | Owner of semantics |
|---|---|---|---|---|
| Address | Canonical local@domain (local part PRECIS-prepared, case-folded, UTF-8 NFC; domain a lowercase A-label) (D-032). The display form goes in a separate name member. |
string | Registration (05, 09) | 01 |
Context reference (ctx) |
ctx-ref (§8.3) |
string | Hosting server; dm: computed by anyone |
03 (format), 09, 12 |
| Stream name | stream (§8.3) |
string | — | 03 |
Message ID (mid) |
uuid7 |
string | The sending client | 11, 14 |
| Other object IDs | uuid7 |
string | Server | Each object's owner |
Envelope id, connection conn |
uuid7 |
string | Sender of the envelope; server | 03 |
Device ID (did) |
did: 16 random bytes, base64url, 22 characters |
string | Home server, at device registration | 05 |
Participant index (pid) |
Integer 0 to 65,535, unique within a call | integer | Hosting server | 15 |
jti |
jti: at least 128 random bits, base64url; issuers SHOULD use exactly 16 bytes |
string | Issuer of the JWS | 04, 06 |
| Server key ID | server-kid, for example a.com#2026-12a |
string | Server | 02 |
Identity and device key IDs (ikf, dkf) |
key-thumbprint: RFC 7638 SHA-256 JWK thumbprint, base64url, 43 characters |
string | Anyone | 04, 07 |
MLS group_id |
mls-group-id, carried as UTF-8 bytes inside MLS |
MLS bytes | Group creator | 13 |
Epoch key ID (ekid) |
b64u-64 |
string | Anyone, from K_hist |
14 |
Sequence number (seq) |
Integer 1 to 2^53 − 1 per stream, gap-free for durable events | integer | The server that owns the stream | 03 |
Idempotency-Key value |
idempotency-key (§14.2) |
header | Client | 03 |
| Pagination cursor | cursor, opaque (§13.2) |
string | Server | 03 |
Problem instance |
problem-instance |
string | Server | 03 |
| Feature name, version, event type, error code | §12.2, §12.1, §11.1, §10.4 | string | Registry | 03 and owners |
Rationale: fixed lengths and canonical final characters let any receiver validate an ID with a regular expression, and give each ID one spelling, which bans, pins and uniqueness checks depend on.
9. Timestamps and durations
timestamp = date %s"T" time "." 3DIGIT %s"Z"
date = 4DIGIT "-" 2DIGIT "-" 2DIGIT ; valid Gregorian date
time = 2DIGIT ":" 2DIGIT ":" 2DIGIT ; hour 00-23, minute 00-59, second 00-59- JSON timestamps are RFC 3339
date-timevalues in UTC, with exactly three fractional digits and an uppercaseZ, for example"2026-12-04T10:15:30.123Z". Producers MUST emit exactly thetimestampform above. A leap second is written as second 59. - Consumers MUST accept the
timestampform. For robustness they SHOULD also accept any RFC 3339date-time(any number of fractional digits, lowercasetorz, or a numeric offset), converting it to UTC and truncating to milliseconds. A value that isn't an RFC 3339date-timeis invalid (400core.invalid_requestat a server). - Member names of timestamps end in
At(createdAt,lastItemAt). The envelope membertsis the one exception. - Times inside signed objects (
iat,exp,nbfand the like) are JWS NumericDate integer seconds (04). Verifiers allow ±60 s of clock skew (00 §7.7). - Durations are non-negative integers in milliseconds with member names ending in
Ms(retryAfterMs,pingIntervalMs). HTTP headers keep their own units:Retry-Afteris in whole seconds, andRateLimituses seconds (§15). - Media timestamps are 32-bit counters: 48 kHz for audio, 90 kHz for video (16, 17). Lease expiry is measured on the audio engine's monotonic clock (15, 16).
- Timestamps never decide the order of events in a stream;
seqdoes. A client shows timestamps in the user's local time zone.
10. Errors
10.1 The problem object
HTTP errors use RFC 9457 problem details with Content-Type: application/problem+json. WebSocket errors carry the same object in d (§6.3), and SubscriptionResults and session.subscription_ended carry it in problem.
| Member | Type | Required | Meaning and constraints |
|---|---|---|---|
type |
string | Yes | urn:sloppyv:error: followed by code. Clients use code, not type. |
code |
string | Yes | The registered error code (§10.4). |
title |
string | Yes | A short summary, at most 200 characters, in English unless the server honours Accept-Language. Clients don't parse it. |
status |
integer | Yes | The HTTP status. Over HTTP it MUST equal the response status. |
detail |
string | No | Human-readable detail, at most 1,000 characters. |
instance |
string | No | urn:uuid:<UUIDv7> identifying this occurrence, which the server logs. |
retryable |
boolean | Yes | Whether the same request may succeed later without any change. |
retryAfterMs |
integer | No | The minimum delay before retrying. Absent or null means no hint. Required for core.rate_limited. |
userAction |
string | Yes | One of the values in §10.2. As the code's registry entry defines (§10.4 rule 2). |
data |
object | No | Code-specific structured data, defined by the code's owner. |
Rules:
- A response that carries both
Retry-AfterandretryAfterMsMUST keep them consistent:Retry-AfterisretryAfterMsdivided by 1,000, rounded up. A client usesretryAfterMswhen both are present. - A problem object MUST NOT contain tokens, keys, secret values, stack traces or internal host names, and MUST NOT reveal anything about resources the caller isn't allowed to see.
- Clients render
titleanddetailonly as plain text, never as markup, and preferably not at all (§10.3). - Clients include
instance, when present, in diagnostics and in the "contact the admin" flow so that the admin can find the log entry.
10.2 The userAction enum
userAction lets a client offer the one-tap fix without parsing any text. A client treats an unknown value as none.
| Value | Meaning | Client behaviour |
|---|---|---|
none |
Nothing the user can do will fix this request. | Show a short failure message for the action, from the code if known. No button. |
retry |
Trying again may work. | Offer "Try again". Retry automatically first where §2.7 allows. |
wait |
Temporary overload or unavailability. | Retry automatically after retryAfterMs. Show a waiting state only if the user is waiting on this action for more than 2 s. No button needed. |
sign_in |
The client session is gone. | Recover silently first (§3.3). If that fails, show the sign-in screen for the home server (M1), then resume the interrupted action. Only the home server can cause this screen (scope rules below). |
enable_encryption |
The account must turn on encryption. | Show G1, "Turn on encryption" (M4). Resume the action afterwards. |
set_up_device |
This device must be set up for encryption. | Show G2, "Set up encryption on this device" (pairing M5 or recovery key). Resume the action afterwards. |
update_app |
The app is too old for this server. | Show the "update required" screen with a link to the app's update channel. |
contact_admin |
Only the server's operator can fix this. | Say so in one sentence, offer the contact information from ServerMetadata (02) if present, and show instance if present. |
Exact copy for these screens is owned by 20.
Scope of a userAction. A userAction applies only to the server that sent it, so a remote server, malicious or misconfigured, can't push a user into screens that belong to another server:
- A client shows the home sign-in screen only when its home server itself answers with
userActionsign_in, or with a 401 after a failed refresh (§3.3). - A
sign_infrom a remote server only triggers silent recreation of the remote session (§3.3, 06), at most once per 60 s per server. If that keeps failing while the home server is fine, the client treats that remote server as unavailable (as forwait) and never prompts the user because of it. update_appandcontact_adminfrom a server apply only to that server and its contexts; other servers keep working (§12.4).enable_encryptionandset_up_devicelead to G1 and G2 only for the action the user was taking in that server's context (00 §4.12.2).
10.3 Client handling of errors
- For a code the client knows, it follows the owner's handling.
- For a code it doesn't know, it uses the generic members:
userActiondecides what the user sees,retryableandretryAfterMsdecide automatic retries (§2.7), andstatusdecides the generic message for its class. Unknown codes never crash or block the client. - A 4xx or 5xx response without an
application/problem+jsonbody (from a proxy or load balancer, for example) is treated as follows:
| Status | Treated as |
|---|---|
| 401 | core.unauthenticated |
| 404 | core.not_found |
| 413 | core.too_large |
| 425 | core.too_early, retryable: retry once at once over a full handshake, without early data (§2.2 item 4) |
| 429 | core.rate_limited, using Retry-After if present, else 5 s |
| 502, 503, 504 | core.unavailable, retryable |
| Other 5xx | core.internal, retryable |
| Other 4xx | core.invalid_request, not retryable |
- A client never shows raw HTTP status numbers, codes or
detailtext as the main message to a user. Diagnostics views MAY show them.
10.4 The error-code registry
error-code = area "." reason
area = LCALPHA *( LCALPHA / DIGIT ) / ext-area
ext-area = %s"x-" 1*( LCALPHA / DIGIT )
reason = LCALPHA *( LCALPHA / DIGIT / "_" )Area allocation (00 §7.5). A document registers error codes and event types only in its own areas.
| Area | Owner | Event types | Error codes |
|---|---|---|---|
core |
03 | No | Yes (§10.5) |
session |
03 | Yes (§11.3) | Yes (§10.6) |
address |
01 | Yes | Yes |
discovery |
02 | Yes | Yes |
crypto |
04 | Yes | Yes |
auth, account, device, bot |
05 | Yes | Yes |
federation |
06 | Yes | Yes |
identity |
07 | Yes | Yes |
pairing, backup, vault |
08 | Yes | Yes |
community, member, channel, invite |
09 | Yes | Yes |
role, permission, moderation, report |
10 | Yes | Yes |
message, reaction, typing, read, presence, attachment |
11 | Yes | Yes |
dm |
12 | Yes | Yes |
mls |
13 | Yes | Yes |
history, sealed |
14 | Yes | Yes |
call, relay, sfu |
15 | Yes | Yes |
media |
18 | Yes | Yes |
notify, push, notification |
19 | Yes | Yes |
security |
00 | No | Yes (00 §4.11) |
relayctl |
21 | No (messages of the sloppyv-relay-control.v1 subprotocol only, never on /v1/events) |
No (uses core.*) |
x-<name> |
Implementation extensions | Yes | Yes |
Documents 16, 17, 20 and 22 own no area; 21 owns only the relayctl message namespace. Diagnostics or codes that 16 and 17 need are registered by 15 (call) or 18 (media).
Registration rules.
- Each owner lists its codes in its own document, in a table with: code, HTTP status,
retryable,userAction,datamembers, and meaning. That table is the registry entry; this document indexes it (§10.7). - Each code has one HTTP status, one
retryablevalue and oneuserAction, except that an entry MAY makeretryableoruserActiondepend on a condition it states exactly (for examplecore.idempotency_conflict, 04'scrypto.unknown_key, 06'sfederation.session_ended, 13'smls.credential_rejectedandmls.group_full). The status differs from the entry's only in two cases: (a) when the failing object is the request's authentication credential, acrypto.*ordiscovery.*code is answered with 401 andWWW-Authenticate(04 §6.9); (b) at 05's OAuth endpoints/v1/auth/parand/v1/auth/token, statuses follow 05 §7.8. Clients always use the values in the problem object (§10.3). - Within protocol version 1 a code's status,
userActionand meaning, including any condition its entry states, never change, and a code is never removed or reused. A code that is no longer emitted stays reserved. - New codes may be added in a minor version (§12.3), because clients handle unknown codes (§10.3).
- An owner uses a
core.*code only where no more specific code would help the client act. It MUST NOT register a code whose meaning is exactly that of a core code. - A new area needs a change to 00 §7.5 and to this table.
x-areas are for implementation-specific extensions. Conforming peers MUST NOT need them to interoperate, and treat them as unknown.- Local and non-HTTP codes. An owner MAY register codes in its area that never travel in an HTTP response or on the event WebSocket: local diagnostic codes (04 §15.2) and codes carried only inside another protocol's messages (15's
relay.bad_messageinrelay.error). Their entries give no HTTP status (write "—"), and such a code MUST NOT appear in an HTTP or WebSocket problem object.
10.5 The core.* codes
| Code | HTTP | retryable |
userAction |
data |
Meaning |
|---|---|---|---|---|---|
core.invalid_request |
400 | false | none |
errors (below) |
The request is malformed or fails validation: bad JSON, missing or wrong-typed member, invalid identifier, invalid parameter. |
core.unauthenticated |
401 | false | sign_in |
— | No credential, or a credential that is invalid, revoked or of the wrong kind for the endpoint (§3). |
core.token_expired |
401 | true | none |
— | The access token expired. The client refreshes or renews it silently (§3.3) and retries. |
core.forbidden |
403 | false | none |
permission (string, optional): the registry permission that was missing (10 §6.3); ctx (string, optional): the context in which it was checked (10 §6.3); missingRole (string, optional): a required system role, admin when the request needs 10's admin role (09 §11.1, 10 §4.2) |
Authenticated, but not allowed, and no more specific code applies. |
core.not_found |
404 | false | none |
reason (string, optional): unknown_endpoint when the server doesn't implement the endpoint (§2.1). Unknown values are ignored. |
No such resource or endpoint, or one the caller isn't allowed to know exists. An unknown endpoint means the feature is absent (§12.3). |
core.method_not_allowed |
405 | false | none |
allow (array of string) |
The endpoint doesn't support the method. The response carries Allow. |
core.conflict |
409 | false | none |
— | The request conflicts with the resource's current state, and the owner has no more specific code. |
core.idempotency_conflict |
409 | varies: true for in_progress, false for mismatch |
none |
reason: mismatch or in_progress |
An idempotency key or client-generated ID was reused with a different request, or the first request with that key is still being processed (§14). |
core.gone |
410 | false | none |
— | The resource existed and is permanently gone, or a cursor has expired (§13.2). |
core.too_large |
413 | false | none |
limit (string, the limit name, for example maxRequestBytes), max (integer) |
The body, or a member of it, exceeds an advertised limit. |
core.unsupported_media_type |
415 | false | none |
accept (array of string) |
The body's Content-Type isn't one the endpoint accepts. |
core.too_early |
425 | true | retry |
— | The request arrived in TLS early data and isn't a GET (§2.2 item 4, RFC 8470). The client retries it once at once over the completed handshake. |
core.rate_limited |
429 | true | wait |
policy (string, §15.2) |
A rate limit was exceeded. retryAfterMs is required; HTTP responses also carry Retry-After. |
core.unsupported_version |
400 | false | update_app |
supported (array of version strings), minClient (string, optional) |
The protocol version, subprotocol or envelope version isn't supported, or the client is older than minClient (§12). A server that serves only versions older than the client's is reported by 02's discovery.version_unsupported instead (02 §7.4). |
core.unsupported_feature |
501 | false | none |
feature (string) |
The endpoint exists, but the request needs an optional feature (§12.2) that the server, or the federation peer it depends on, doesn't offer or has turned off. |
core.internal |
500 | true | retry |
— | An unexpected server error. |
core.unavailable |
503 | true | wait |
— | The server, or a server it depends on (for example a federation peer), is temporarily unavailable. retryAfterMs SHOULD be given. |
core.invalid_request data. errors is an array of at most 32 items:
| Member | Type | Required | Meaning |
|---|---|---|---|
source |
string | Yes | body, query, path or header. Unknown values are treated as body. |
pointer |
string | When source is body |
RFC 6901 JSON Pointer to the offending member. |
name |
string | When source isn't body |
The parameter or header name. |
reason |
string | Yes | missing, type, format, range, length, enum, duplicate, not_allowed or other. Unknown values are treated as other. |
detail |
string | No | Plain-text detail for developers. |
HTTP/1.1 400 Bad Request
Content-Type: application/problem+json
Cache-Control: no-store
Access-Control-Allow-Origin: *
{
"type": "urn:sloppyv:error:core.invalid_request",
"code": "core.invalid_request",
"title": "Invalid request",
"status": 400,
"instance": "urn:uuid:01a2424b-9d88-7111-a222-333344445559",
"retryable": false,
"userAction": "none",
"data": {
"errors": [
{ "source": "body", "pointer": "/mid", "reason": "format", "detail": "mid must be a lowercase UUIDv7" },
{ "source": "query", "name": "limit", "reason": "range", "detail": "limit must be 1 to 100" }
]
}
}The core codes of 00 §7.9 include core.method_not_allowed (405), core.unsupported_media_type (415) and core.too_early (425), and core.unsupported_feature uses 501. Rationale: each HTTP-level failure gets its own code with one status, as §10.4 rule 2 requires; without core.too_early, a client would map an early-data 425 to a non-retryable core.invalid_request, against RFC 8470. For 501: RFC 9110 defines 501 as "the server does not support the functionality required to fulfil the request", which is exactly this case, and retryable: false stops clients from retrying it like other 5xx responses.
10.6 The session.* codes
These codes occur only on the WebSocket. status holds the value below.
| Code | Status | retryable |
userAction |
data |
Meaning | Fatal? |
|---|---|---|---|---|---|---|
session.hello_required |
400 | false | none |
— | A message other than session.hello arrived before the socket was ready. |
Yes: close 4000 |
session.duplicate_hello |
400 | false | none |
— | session.hello arrived on a socket that is already ready. It is ignored. |
No |
session.unsupported_message |
400 | false | none |
type (string) |
The client sent a message type the server doesn't accept from clients (§6.2). It is ignored. | No |
session.subscription_limit |
400 | false | none |
max (integer) |
Subscribing would exceed maxSubscriptions. Appears in a SubscriptionResult. |
No |
session.wrong_session |
400 | false | none |
— | The token in session.reauth is valid but belongs to a different client session from the socket's (§5.13). It is ignored. |
No |
10.7 Index of codes defined elsewhere
The owners' tables are normative; this index lists the codes 00 names, the owners' codes this document relies on, and the codes of 14's history sharing, which several documents use, so that every document refers to them consistently.
| Code | HTTP | retryable |
userAction |
data (members optional) |
Owner |
|---|---|---|---|---|---|
security.account_required |
403 | false | enable_encryption |
As 00 §4.11 defines (for example scope: community or channel, ctx, domain; 09 §9.3) |
00 §4.11 |
security.device_not_enrolled |
403 | false | set_up_device |
As 00 §4.11 defines (for example ctx) |
00 §4.11 |
security.upgrade_required |
403 | false | enable_encryption |
As 00 §4.11 defines | 00 §4.11 |
security.server_requires_secure |
409 | false | none |
As 00 §4.11 defines | 00 §4.11 |
security.downgrade_forbidden |
409 | false | none |
As 00 §4.11 defines | 00 §4.11 |
security.would_downgrade |
409 | false | none |
As 00 §4.11 defines (for example insecure, the insecure addresses; 12) |
00 §4.11 |
security.context_secure_unsupported |
403 | false | none |
As 00 §4.11 defines | 00 §4.11 |
address.non_canonical |
per 01 | per 01 | per 01 | per 01 | 01 |
discovery.domain_not_served |
per 02 | per 02 | per 02 | per 02 | 02 |
mls.epoch_conflict |
409 | per 13 | per 13 | per 13 | 13 |
mls.commit_required |
409 | per 13 | per 13 | per 13 | 13 |
mls.credential_rejected |
per 13 | per 13 | per 13 | per 13 | 13 |
mls.verification_failed |
per 13 | per 13 | per 13 | per 13 | 13 |
mls.commit_busy (MLS commit overload) |
425 | per 13 | wait, per 13 |
per 13 | 13 |
history.share_invalid |
400 | false | none |
field |
14 §15 |
history.share_forbidden |
403 | false | none |
reason: permission, bot, self, recipient_not_member or recipient_not_in_group (unknown: permission) |
14 §15 |
history.share_range_invalid |
422 | false | none |
reason: beyond_head, count or not_visible (unknown: not_visible) |
14 §15 |
history.share_too_large |
413 | false | none |
max (5,000) |
14 §15 |
history.disabled |
409 | false | none |
reason: insecure (unknown: insecure) |
14 §15 |
history.not_member |
403 | false | none |
— | 14 §15 |
federation.s2s_unauthenticated (a client token or a bad S2S token on an S2S endpoint, §3.2 item 4) |
401 | per 06 | per 06 | per 06 | 06 |
federation.session_ended (a remote session ended, §5.10 close code 4004) |
401 | per 06 | per 06 | per 06 | 06 |
Every other code is listed in its owner's error table, in the areas of §10.4.
11. The event-type registry
11.1 Grammar and naming
event-type = area "." name / %s"error"
name = LCALPHA *( LCALPHA / DIGIT / "_" )area is defined in §10.4. Types are lowercase. An event that reports something that happened uses a past-tense verb (message.created, channel.security_changed); a request or a state snapshot uses a noun or an imperative (session.hello, call.tick, mls.commit_needed) (00 §7.5). S2S events use the same naming and the same areas. error is the one type outside the <area>.<name> form; it is reserved by this document.
11.2 Registration rules
- Each owner lists the event types it defines in its own document, in a table with these columns: type; transport (client WebSocket, S2S, or both); direction; class (
durable,ephemeralor, for S2S-only types,s2s); stream (context,meorcommunity, and whether it is targeted at particular sessions); for durable events, whether it is a timeline item; and where the payload is defined. - A timeline item is a durable event that appears as an entry in a context's timeline: a message, or a system line such as a membership change or a timeline marker that an event carries (00 §4.12.3, for example K1 or K8). 11 decides which of its types are timeline items; 09, 10, 12 and 14 decide for system lines they cause. Timeline items are what timeline pages list (§13.1) and what
lastItemSeqcounts (§5.7). - A type is defined only in its owner's areas (§10.4). A type has one class; it is never durable in one place and ephemeral in another. A type that is both an S2S event and a client event (for example
identity.changed) may have a different payload on each transport, as its owner defines. - Within protocol version 1, a type's class, stream kind and meaning never change, and a type is never removed or reused. New types may be added in a minor version: receivers ignore unknown types, and a durable event of an unknown type still advances the client's position (§7.3).
- The
sessionarea anderrorbelong to this document. No other document may define a client-to-server WebSocket message (§6.2). - S2S events are carried in 06's S2S event envelope with 06's delivery, retry and de-duplication. They have no
seqin the sense of §7 and never appear on a client WebSocket under the S2S type unless the owner also defines a client form.
11.3 Index
This index lists every event type of protocol version 1, client and S2S. The rows for this document's own types are normative. Every other row is an informative mirror of its owner's registration (§11.2), which is normative; where they differ, the owner's table wins and this index is corrected. "Home" and "hosting" name the server that sends the event. "Targeted" means the owner sends the event to particular sessions or devices (§7.2 E5).
Types owned by this document.
| Type | Direction | Class | Section |
|---|---|---|---|
session.hello |
Client to server | Control | §5.4 |
session.ready |
Server to client | Control | §5.5 |
session.subscribe |
Client to server | Control | §5.6 |
session.subscribed |
Server to client | Control | §5.6 |
session.unsubscribe |
Client to server | Control | §5.6 |
session.unsubscribed |
Server to client | Control | §5.6 |
session.subscription_ended |
Server to client | Control | §5.6 |
session.heads |
Server to client | Control (coalescable) | §5.7 |
session.state |
Client to server | Control | §5.8 |
session.ping |
Both | Control | §5.9 |
session.pong |
Both | Control | §5.9 |
session.closing |
Server to client | Control | §5.10 |
session.reauth |
Client to server | Control | §5.13 |
session.reauthed |
Server to client | Control | §5.13 |
session.resync_required |
Server to client | Control | §7.5 |
error |
Server to client | Control | §6.3 |
Client WebSocket events of other documents (all server to client).
| Type | Owner | Class | Stream | Notes |
|---|---|---|---|---|
discovery.metadata_changed |
02 | Ephemeral | me |
Also an S2S event (below) |
discovery.peer_suspended |
02 | Durable | me at the home server |
To local accounts holding the admin system role (02 §16.2, 10 §4.2) |
discovery.peer_resumed |
02 | Durable | me at the home server |
As discovery.peer_suspended |
account.updated |
05 | Durable | me at the home server |
|
account.deleted |
05 | Durable | me at the home server |
Also an S2S event |
auth.provider_linked |
05 | Durable | me at the home server |
|
auth.provider_unlinked |
05 | Durable | me at the home server |
|
device.added |
05 | Durable | me at the home server |
With via: "login" it raises W4d on the account's other devices (05 §12.12, D-084); never a warning otherwise |
device.updated |
05 | Durable | me at the home server |
|
bot.created |
05 | Durable | me at the home server |
To the bot owner's devices |
bot.updated |
05 | Durable | me at the home server |
As bot.created |
bot.deleted |
05 | Durable | me at the home server |
As bot.created |
federation.session_ended |
06 | Ephemeral | me at the remote server |
Precedes close code 4004 (§5.10) |
identity.changed |
07 | Durable | me at the subject's home server |
Also an S2S event |
device.revoked |
07 | Durable | me at the subject's home server |
Also an S2S event |
identity.refresh_hint |
07 | Ephemeral, targeted | me at a DM hosting server |
To the sessions of DM participants |
pairing.requested |
08 | Ephemeral, targeted | me at the home server |
To the account's enrolled devices |
pairing.updated |
08 | Ephemeral, targeted | me at the home server |
To the pairing participants |
pairing.message |
08 | Ephemeral, targeted | me at the home server |
To the participant addressed |
backup.updated |
08 | Ephemeral, targeted | me at the home server |
|
vault.changed |
08 | Ephemeral, targeted | me at the home server |
|
vault.rotation_needed |
08 | Ephemeral, targeted | me at the home server |
|
vault.key_rotated |
08 | Ephemeral, targeted | me at the home server |
|
vault.grant_needed |
08 | Ephemeral, targeted | me at the home server |
|
community.updated |
09 | Durable | community |
|
community.security_changed |
09 | Durable | community |
|
community.layout_changed |
09 | Durable | community |
Viewer-dependent payload |
community.list_changed |
09 | Durable | me at the home server |
|
member.joined |
09 | Durable | Channel context (timeline item) or community |
|
member.left |
09 | Durable | As member.joined |
|
member.removed |
09 | Durable | Channel context (timeline item) or community; and the removed account's me |
|
member.updated |
09 | Durable | Channel context or community; and the member's own me |
|
member.requested |
09 | Durable | me |
To holders of manage_invites |
member.rejected |
09 | Durable | me |
To the requester |
channel.created |
09 | Durable | community; and me on a visibility change |
Viewer-dependent payload |
channel.updated |
09 | Durable | community |
Viewer-dependent payload |
channel.deleted |
09 | Durable | community; and me on a visibility change |
Viewer-dependent payload |
channel.security_changed |
09 | Durable | The channel's context (timeline item, K1) | |
invite.created |
09 | Durable | me |
|
invite.revoked |
09 | Durable | me |
|
role.created |
10 | Durable | community |
|
role.updated |
10 | Durable | community |
|
role.deleted |
10 | Durable | community |
|
role.reordered |
10 | Durable | community |
|
role.member_added |
10 | Durable | community |
|
role.member_removed |
10 | Durable | community |
|
permission.overwrite_set |
10 | Durable | The channel's context | Not a timeline item |
permission.overwrite_removed |
10 | Durable | The channel's context | Not a timeline item |
permission.changed |
10 | Ephemeral, targeted | me |
|
moderation.applied |
10 | Durable | me |
To the target |
moderation.lifted |
10 | Durable | me |
To the target |
moderation.server_mute_changed |
10 | Durable | community |
|
moderation.policy_updated |
10 | Durable | community |
Viewer-dependent payload |
moderation.logged |
10 | Durable | me |
To holders of view_audit_log |
report.created |
10 | Durable | me |
|
report.updated |
10 | Durable | me |
|
report.resolved |
10 | Durable | me |
To the reporter |
message.created |
11 | Durable | The context (timeline item) | |
message.edited |
11 | Durable | The context | |
message.deleted |
11 | Durable | The context | |
message.purged |
11 | Durable | The context | |
reaction.added |
11 | Durable | The context | |
reaction.removed |
11 | Durable | The context | |
read.updated |
11 | Durable | me |
The account's own sessions |
typing.started |
11 | Ephemeral, targeted | The context | |
typing.stopped |
11 | Ephemeral, targeted | The context | |
presence.updated |
11 | Ephemeral, targeted | me |
|
presence.snapshot |
11 | Ephemeral, targeted | The context | To the session that just subscribed |
dm.created |
12 | Durable | The DM's context | Timeline item |
dm.participant_added |
12 | Durable | The DM's context | Timeline item |
dm.participant_removed |
12 | Durable | The DM's context | Timeline item |
dm.participant_updated |
12 | Durable | The DM's context | Timeline item |
dm.settings_changed |
12 | Durable | The DM's context | Timeline item |
dm.call_logged |
12 | Durable | The DM's context | Timeline item |
dm.security_eligible |
12 | Durable | The DM's or group DM's context | Not a timeline item. Emitted for any insecure DM, 1:1 or group, that becomes eligible for encryption |
dm.security_changed |
12 | Durable | The DM's context | Timeline item |
dm.closed |
12 | Durable | The DM's context | Timeline item |
dm.state_changed |
12 | Durable | The DM's context | Not a timeline item |
dm.index_updated |
12 | Durable | me at the home server |
|
dm.index_removed |
12 | Durable | me at the home server |
|
dm.request_received |
12 | Durable | me at the home server |
|
dm.request_resolved |
12 | Durable | me at the home server |
|
dm.block_updated |
12 | Durable | me at the home server |
|
dm.settings_updated |
12 | Durable | me at the home server |
|
mls.group_created |
13 | Durable | The secure context | |
mls.handshake |
13 | Durable | The secure context | |
mls.proposal |
13 | Durable | The secure context | |
mls.group_retired |
13 | Durable | The secure context | |
mls.commit_needed |
13 | Ephemeral, targeted | The secure context | To the designated committer |
mls.welcome |
13 | Ephemeral, targeted | The secure context | To devices added by Welcome, subscribed or not |
mls.resync_required |
13 | Ephemeral, targeted | The secure context | |
mls.keypackages_low |
13 | Ephemeral, targeted | me at the home server |
|
history.shared |
14 | Durable | The secure context (timeline item, K8) | To every subscriber; the recipient's clients also fetch the HistoryShare (14 §9.1, §7.8) |
call.state |
15 | Ephemeral, targeted | The call's context | To a session whose socket gains a full subscription to the context, by resume or subscribe in session.hello (including on every reconnect) or in session.subscribe, and after a session.resync_required for it (15 §3.1) |
call.started |
15 | Ephemeral | The call's context | |
call.participant_joined |
15 | Ephemeral | The call's context | |
call.participant_updated |
15 | Ephemeral | The call's context | |
call.participant_left |
15 | Ephemeral | The call's context | |
call.ended |
15 | Ephemeral | The call's context | |
call.ring_updated |
15 | Ephemeral | The call's context | |
call.tick |
15 | Ephemeral, targeted | The call's context | To participating devices; also on the relay's control data channel (D-046) |
call.lease_changed |
15 | Ephemeral, targeted | The call's context | |
call.epoch_switch |
15 | Ephemeral, targeted | The call's context | |
call.route_changed |
15 | Ephemeral, targeted | The call's context | |
call.moved |
15 | Ephemeral, targeted | The call's context | |
call.migrate |
15 | Ephemeral, targeted | The call's context | |
call.ringing |
15 | Ephemeral, targeted | me at the hosting server |
To every session of each ring target account, subscribed or not; the call's context is in d.ctx |
call.ring_ended |
15 | Ephemeral, targeted | me at the hosting server |
To every session of the target account |
sfu.offer |
15 | Ephemeral, targeted | The call's context | |
sfu.tracks_changed |
15 | Ephemeral, targeted | The call's context | |
sfu.closed |
15 | Ephemeral, targeted | The call's context | |
notify.triggered |
19 | Ephemeral, targeted | me at the hosting server |
|
notification.created |
19 | Durable | me at the home server |
|
notification.updated |
19 | Durable | me at the home server |
|
notification.state_changed |
19 | Durable | me at the home server |
|
notification.settings_changed |
19 | Durable | me at the home server |
|
push.registration_removed |
19 | Durable | me at the home server |
S2S events (class s2s, carried by 06; 06 §10.1 holds the delivery parameters).
| Type | Owner | Origin → destination |
|---|---|---|
discovery.metadata_changed |
02 | Any server → its recent S2S peers |
account.deleted |
05 | Home server → the account's audiences |
account.suspended |
05 | Home server → the account's audiences |
account.profile_changed |
05 | Home server → the account's audiences |
identity.changed |
07 | Home server → the account's audiences |
device.revoked |
07 | Home server → the account's audiences |
report.forwarded |
10 | Forwarding server → the reported account's home server |
dm.request |
12 | Hosting server → each recipient's home server |
dm.response |
12 | Recipient's home server → hosting server |
dm.entry_updated |
12 | Hosting server → a participant's home server |
notify.event |
19 | Hosting server → recipient's home server |
call.epoch_ready (15) and mls.epoch_ack (13) are posted by clients over HTTP to endpoints their owners define, because the socket carries no client commands (§6.2). Documents 01, 04, 16, 17 and 18 define no event types.
Class by kind of event (00 §7.4). Timeline events, membership changes, MLS handshakes and DM index changes are durable. Typing, presence, lease ticks and call state are ephemeral. An owner's registration MUST agree with this.
12. Features and versioning
12.1 Protocol versions
version = major "." minor
major = %x31-39 *2DIGIT
minor = "0" / ( %x31-39 *3DIGIT )- A protocol version is
major.minor. Version 1 issv1(D-025). Major versionNis served at{base}/vN/with the WebSocket subprotocolsloppyv.vN. - ServerMetadata
versions(02) lists one entry per major version the server serves, each giving the highest minor version it implements, for example["1.0"]or later["1.3", "2.0"]. A server implementing1.3implements every1.xup to 3. - A client uses the highest major version that both it and the server support. Within a major version there is no negotiation: a client MUST NOT rely on behaviour introduced in a minor version higher than the one the server lists.
session.readyrepeats the server's minor version for the major in use. - Minor versions only increase, and are additive only (§12.3).
12.2 Features
feature = feat-name [ "/" %x31-39 *2DIGIT ]
feat-name = LCALPHA *( LCALPHA / DIGIT / "-" )- A feature is an optional or versioned capability, named by its owner. A feature name is at most 64 characters; a feature list has at most 64 entries.
- Servers advertise their features in ServerMetadata
features(02), and MUST list every feature they implement, including the mandatory ones. Clients send theirs insession.hello. Federation peers read each other's metadata (06). - The effective feature set of a client session is the intersection of the server's
featuresand the client'sfeatures; the server returns it insession.ready. Between two servers it is the intersection of their metadatafeatures. - Neither side may use a feature outside the effective set. A server MUST NOT send a client anything that needs a feature outside the client's effective set (for example, it never offers
sfu-rtp/1media to a client that didn't list it). A request to an endpoint the server implements that needs a feature the server doesn't offer, or has turned off, is answered with 501core.unsupported_feature. An endpoint the server doesn't implement at all is answered with 404core.not_found(data.reasonunknown_endpoint, §2.1). Clients decide whether a feature is present fromfeaturesandversions, not by probing for 404s; a 404 under/v1/contexts/{ctx}/…withoutunknown_endpointmeans the context or object doesn't exist. - Unknown feature names are ignored.
- A feature's version number increases for an incompatible change of that feature. Both versions MAY be offered side by side (for example
voice-dc/1andvoice-dc/2).
Feature registry.
| Feature | Owner | Servers | Clients | Meaning |
|---|---|---|---|---|
voice-dc/1 |
16 | Mandatory | Mandatory for Full and Web clients; optional for Bot clients | Voice frames over WebRTC data channels through the hosting server's relay (D-094). |
video-dc/1 |
17 | Mandatory | Mandatory for Full and Web clients; optional for Bot clients | Screen share and webcam over WebRTC data channels. |
sfu-rtp/1 |
17 | Optional; required for the SFU-capable server class | Mandatory for Full and Web clients; optional for Bot clients | RTP media through an SFU. |
webhooks |
11 | Optional | Not applicable (management endpoints only) | Webhooks in insecure contexts. |
Secure-mode support is mandatory for every server and has no feature flag (D-066). New features are registered by adding a row to this table; a document that defines one lists it in a "Registry additions" subsection. Names beginning x- are implementation extensions and MUST NOT be needed for interoperability.
12.3 Compatibility rules
Additive changes, allowed in a minor version:
- new optional members in requests (servers MUST NOT require them from older clients), responses, envelopes and payloads;
- new endpoints, event types, error codes, features and limit names;
- new enum values, where the owner's unknown-value rule (below) keeps older receivers correct;
- raising a limit's default.
Breaking changes, which need a new major version:
- removing or renaming a member, endpoint, event type, error code or feature;
- changing a member's type or meaning, an event's class, or an error code's status or
userAction; - making an optional request member required;
- lowering a limit's floor;
- any change that makes a conforming older peer violate a security rule.
Handling unknown things.
| Unknown thing | Receiver behaviour |
|---|---|
| Member | Ignore it (§2.4). |
| Event type | Ignore it; for a durable event, advance the position (§7.3). |
| Endpoint | The server answers 404 core.not_found with data.reason unknown_endpoint; the caller treats the feature as absent. |
| Error code | Use the generic members (§10.3). |
| Feature | Ignore it. |
| Limit name | Ignore it. |
| Enum value | As the enum's definition says (below). |
Unknown enum values. Every enum definition MUST say which of these rules applies to an unknown value:
- fallback: treat it as a named known value (for example
userActionfalls back tonone); - ignore item: ignore the array element or object that contains it;
- reject: the whole message is invalid. Owners use this only where any other reading could be unsafe, for example a security mode.
If a definition doesn't say, a server treats the value as invalid input (400 core.invalid_request) and a client applies rule 2.
12.4 minClient
minClient in ServerMetadata (02) is a protocol version string (§12.1): the lowest version a client must implement to use the server.
- A client that implements a lower version of that major version MUST show the "update required" screen (
update_app) for that server, and MUST NOT use it beyond reading/meta. Other servers keep working. - A server MAY refuse a
session.hellowhoseprotocolis lower thanminClient, withcore.unsupported_versionand close code 4026 (§5.3). - Operators SHOULD raise
minClientonly to stop a client behaviour that is insecure or breaks other users.
Rationale: minClient is a protocol version, not an app build number, so it works the same for every client implementation.
12.5 New major versions and deprecation
- A breaking change creates a new major version with its own path (
/v2) and subprotocol (sloppyv.v2), listed inversions. - A server that starts serving a new major version MUST keep serving the previous one, on HTTP, on the WebSocket and on S2S endpoints, for at least 12 months after it first lists the new one (00 §7.8).
- During that time, responses on the old version SHOULD carry
Deprecation(RFC 9745) and, once a date is fixed,Sunset(RFC 8594). Clients MAY show a gentle "an update is available" note; they MUST NOT block the user while the old version still works. - After the sunset, the old path answers 400
core.unsupported_versionwithuserActionupdate_app, and the old subprotocol is refused at handshake (§5.1). - Servers federate using the highest major version both list.
13. Pagination
13.1 Timelines
Endpoints that list the timeline items of a sequenced context (11 owns them) page by seq.
| Query parameter | Type | Meaning |
|---|---|---|
before |
integer | Return the items with the highest seq values that are less than this value. |
after |
integer | Return the items with the lowest seq values that are greater than this value. |
limit |
integer | 1 to 100; default 50. |
beforeandafterare mutually exclusive; a request with both is answered with 400core.invalid_request. With neither, the server returns the most recent items, as ifbeforewereheadSeq + 1.limitoutside 1 to 100, or a non-integer value, is answered with 400core.invalid_request.- The response is:
| Member | Type | Required | Meaning |
|---|---|---|---|
items |
array | Yes | Timeline items, each with its seq, always in ascending seq order, whichever direction was asked for. |
hasMore |
boolean | Yes | With before, or neither parameter: whether the caller can see items older than the first one returned. With after: whether there are items newer than the last one returned, up to headSeq. |
headSeq |
integer | Yes | The stream's head when the page was read. |
- The
seqvalues initemsare not contiguous: the stream also contains durable events that aren't timeline items, and items the caller isn't allowed to see (before its current membership began in a secure context, 14 §10.2, or removed by retention) are left out. - To page backwards, use
before = items[0].seq; to page forwards, useafter= the last item'sseq. A page with no items hashasMore: false. headSeqis what §7.5 uses after a resync. It never advances the client's position (§2.8).
GET /server/v1/contexts/ch:01938a11-2b3c-7d4e-8f90-112233445566/messages?before=4182&limit=2 HTTP/1.1
Host: chat.sloppyvoice.com
Authorization: Bearer rs_4kJ7yQm2xV0bP9sLwT3e
HTTP/1.1 200 OK
Content-Type: application/json
Cache-Control: no-store
Access-Control-Allow-Origin: *
{
"items": [
{ "seq": 4178, "mid": "01938f2f-0c1d-7a2b-8c3d-4e5f60718293", "content": { "text": "who's on tonight?" } },
{ "seq": 4181, "mid": "01938f2f-6e7f-7a8b-9c0d-1e2f30415263", "content": { "text": "hi" } }
],
"hasMore": true,
"headSeq": 4190
}The item objects belong to 11 and are abbreviated here.
13.2 Collections
Endpoints that list other things (members, roles, invites, reports, the DM index, devices and so on) page by an opaque cursor.
| Query parameter | Type | Meaning |
|---|---|---|
cursor |
string | The nextCursor of the previous page. Absent for the first page. |
limit |
integer | 1 to 100; default 50. An owner MAY set a different default and a maximum of up to 1,000 for a particular endpoint. |
Response:
| Member | Type | Required | Meaning |
|---|---|---|---|
items |
array | Yes | The page, in the order the owner defines. The order MUST be stable. |
nextCursor |
string or null | Yes | The cursor for the next page, or null at the end. |
total |
integer | No | An owner MAY define an exact or estimated total. |
- A cursor follows the
cursorgrammar (§8.4), so it never needs percent-encoding. Clients MUST NOT build, change or parse cursors. - A cursor is valid only for the same endpoint, the same other query parameters and the same principal. Misuse is answered with 400
core.invalid_request. - A cursor MUST stay valid for at least 1 h after it was issued. An expired cursor is answered with 410
core.gone, and the client restarts from the first page. A malformed one is answered with 400core.invalid_request. - An item that exists and doesn't change during a whole walk appears exactly once. An item added or removed during the walk may or may not appear.
{ "items": [ { "addr": "alice@a.com", "name": "Alice", "state": "active" } ],
"nextCursor": "c2VxPTUwJnJvbGU9Mw" }14. Idempotency
14.1 Client-generated IDs
- A create request that carries a client-generated ID (§8.2), such as the
midof a message, is idempotent on that ID within the scope its owner defines. Formidthe scope is the context (11). - The server records the ID with a fingerprint of the request. The owner defines which parts of the request make up the fingerprint. By default it is the SHA-256 of the exact request body bytes, and a client retrying such a request MUST resend exactly the same bytes. An owner MAY define a different comparison, for example 11 compares the sender account,
kindandtargetso that a message re-sealed under a newer epoch with the samemidis still a resend (11, 14). The fingerprint always includes the principal's account: a reuse of the ID by a different account is a conflict, never a replay. - A resend with the same fingerprint returns the status the owner defines, by default the status of the original (201), with the object's stored or current representation. It doesn't create anything.
- A request that reuses the ID with a different fingerprint is answered with 409
core.idempotency_conflict,reason: "mismatch", unless the owner defines a more specific code. - An ID is reserved only when a create with it succeeds. A request that was rejected before it changed any state (for example with
mls.commit_requiredor a validation error) reserves nothing, so the client may send it again with the same ID and a different body. A reserved ID stays reserved for as long as the object or its tombstone exists, or longer where the owner says so. An owner may define what a resend after deletion returns. - If the first request with an ID is still being processed, a concurrent duplicate is answered with 409
core.idempotency_conflict,reason: "in_progress",retryable: trueand aretryAfterMsof at least 500.
Rationale: a client-generated mid makes the outbox (11) safe to retry after any failure, and in secure contexts it also binds into K_msg (14, D-038), so it must name exactly one message.
14.2 The Idempotency-Key header
Idempotency-Key = idempotency-key / ( DQUOTE idempotency-key DQUOTE )- Any
POST,PATCH,PUTorDELETEto a client endpoint MAY carryIdempotency-Key. Servers MUST honour it on those methods on every client endpoint, except on a create request that carries a client-generated ID, which §14.1 alone governs (item 7), and except on the endpoints of item 8. It is ignored onGET,HEADandOPTIONS, and on requests that carry no credential. S2S event delivery de-duplicates by event ID instead (06). - The value is 1 to 64 characters from the
idempotency-keygrammar (§8.4). The quoted form is the structured-field string of the IETF idempotency-key draft; a server MUST treat"abc"andabcas the same key. Clients SHOULD send a fresh UUIDv7 for each logical operation and the identical value on every retry of it. A value outside the grammar is answered with 400core.invalid_request. - Keys are scoped to the account of the principal. The same key from another account is a different key.
- The fingerprint is the method, the target path after each segment is percent-decoded once (§2.6, so
ch:andch%3Agive the same path), the query parameters as sent and in their original order, and the SHA-256 of the exact body bytes. - Servers keep each key for at least 24 h after its first use.
| Situation | Server behaviour |
|---|---|
| First use | Process the request; store the fingerprint and the final response. |
| Repeat, same fingerprint, first request completed | Return the stored status, headers that matter (Location) and body without processing again. |
| Repeat, same fingerprint, first request still processing | 409 core.idempotency_conflict, reason: "in_progress", retryable. |
| Repeat, different fingerprint | 409 core.idempotency_conflict, reason: "mismatch". |
| Repeat after the retention time | Treated as a first use. |
- Which responses are stored. The server MUST store the response of any request that reached the point of changing state, whatever its status. A response produced before any state change (a validation 400, 401, 403, 429 or a 503 from load shedding) is not stored, so that a retry is evaluated afresh.
- When a request carries a client-generated ID, the ID's rule (§14.1) decides the outcome, and the server ignores any
Idempotency-Keyon it. A client that re-encodes a body (for example re-seals a message) therefore never meets anIdempotency-Keymismatch on such a request. - Credential-issuing endpoints. A server MUST ignore
Idempotency-Key, and MUST NOT store responses, on endpoints whose response carries a newly issued credential:POST /v1/federation/assertionsandPOST /v1/federation/sessions(06 §4.1, §6.1);POST /v1/auth/token,POST /v1/auth/signup,POST /v1/bots,POST /v1/bots/{local}/tokensandPOST /v1/bots/{local}/tokens/{did}/rotate(05). Their owners say how a client recovers from a lost response.
POST /server/v1/channels HTTP/1.1
Host: chat.sloppyvoice.com
Authorization: Bearer hs_Qm9iJ2xV0bP9sLwT3eRk
Content-Type: application/json
Idempotency-Key: "01a2424b-223e-75c3-8123-456789abcdef"
{"name":"Raid night","kind":"voice"}A retry with the body {"kind":"voice","name":"Raid night"}, the same members in another order, has a different fingerprint and is answered with 409 core.idempotency_conflict, reason: "mismatch" (§17.6). The POST /v1/channels body shown is illustrative; 09 owns it.
15. Rate limits
15.1 Partitions
Servers limit requests per client session, per IP address (per IPv4 address, and per IPv6 /64 prefix), and per federation peer (the canonical domain of an S2S token's iss). Owners MAY define further named policies for particular endpoints, for example KeyBackup downloads (08), address lookups (01) or reports (10).
policy-name = 1*64( LCALPHA / DIGIT / "_" / "." / "-" )The base policy names are session, ip, peer, socket (client messages on the WebSocket) and handshake (WebSocket handshakes per IP address). Owners name their policies <area>.<name> from their own areas, for example backup.download.
15.2 Signalling
- An over-limit HTTP request is answered with 429
core.rate_limited, withretryAfterMsanddata.policy, and the headersRetry-After(seconds),RateLimit-PolicyandRateLimitin the structured-field syntax of draft-ietf-httpapi-ratelimit-headers. - Servers SHOULD also send
RateLimitandRateLimit-Policyon successful responses for the policy closest to being exhausted. - On the WebSocket, an over-limit client message is answered with an
errorcarryingcore.rate_limitedandretryAfterMs(§7.6). - 13 defines 425
mls.commit_busywithretryAfterMsfor MLS commit overload. Clients back off from it exactly as from 429. (425core.too_early, §2.2, is different: it is retried at once.)
HTTP/1.1 429 Too Many Requests
Content-Type: application/problem+json
Cache-Control: no-store
Access-Control-Allow-Origin: *
Access-Control-Expose-Headers: Retry-After, RateLimit, RateLimit-Policy, Location, WWW-Authenticate, ETag, Deprecation, Sunset, Link
Retry-After: 3
RateLimit-Policy: "session";q=600;w=60, "ip";q=3000;w=60
RateLimit: "session";r=0;t=3
{
"type": "urn:sloppyv:error:core.rate_limited",
"code": "core.rate_limited",
"title": "Too many requests",
"status": 429,
"retryable": true,
"retryAfterMs": 2400,
"userAction": "wait",
"data": { "policy": "session" }
}15.3 Defaults and floors
A server MUST allow at least the floor, so that a well-behaved client never hits a limit in normal use. The defaults are RECOMMENDED.
| Policy | Floor | Recommended default |
|---|---|---|
session |
120 requests per 60 s | 600 requests per 60 s |
ip, unauthenticated requests |
60 requests per 60 s | 300 requests per 60 s |
ip, all requests |
— | 3,000 requests per 60 s |
peer |
1,200 requests per 60 s | 6,000 requests per 60 s |
socket |
20 messages per 10 s | 60 messages per 10 s |
handshake |
10 handshakes per 60 s | 30 handshakes per 60 s |
CORS preflights don't count toward session (§4).
15.4 Client behaviour
- A client MUST NOT retry a rate-limited request before
retryAfterMs(orRetry-After) has passed. - A client SHOULD spread background work (prefetching, key-archive downloads, HistoryShare verification, KeyPackage uploads) so that it stays well under
sessionlimits, and SHOULD useRateLimitheaders, when present, to slow down before it is refused. - User-visible effects follow
userAction: "wait"(§10.2): a client shows a waiting state only for user-initiated actions delayed by more than 2 s.
16. Size limits
16.1 Naming and advertising
limit-name = %s"max" thing unit
thing = *( %x41-5A 1*( LCALPHA / DIGIT ) ) ; zero or more capitalised words
unit = %s"Bytes" / %s"Ms" / ( %x41-5A 1*LCALPHA ) ; Bytes, Ms, or a plural count noun- Limits are integers advertised in ServerMetadata
limits(02) under names of the formmax<Thing><Unit>:UnitisBytes,Ms, or a plural count noun such asLeaves,Participants,SubscriptionsorEvents. - The owning document defines each limit with a default and a floor. Every conforming server MUST accept at least the floor and MUST NOT advertise less.
- A client uses the advertised value. If a limit is absent from
limits, the client assumes its floor. Unknown limit names are ignored. - Exceeding a limit is answered with 413
core.too_largewithdata.limitanddata.max, unless the owner defines a more specific code.
16.2 Limits owned by this document
| Limit | What it bounds | Default | Floor |
|---|---|---|---|
maxRequestBytes |
The JSON body of one HTTP request, in bytes after any content decoding, unless the endpoint's owner names a different advertised limit for it (13's maxMlsUploadBytes for …/mls/commits and …/mls/bootstrap). Non-JSON bodies, such as attachment uploads, are bounded by their owners (for example maxAttachmentBytes, 11). |
1 MiB (1,048,576) | 256 KiB (262,144) |
maxEventBytes |
One WebSocket envelope in either direction, in UTF-8 bytes. | 1 MiB (1,048,576) | 256 KiB (262,144) |
maxSubscriptions |
Streams one socket may subscribe at any level, not counting me. |
1,000 | 250 |
maxReplayEvents |
Durable events a server replays for one stream on one resume (§7.4); the replay age window is at least 24 h. | 5,000 | 1,000 |
Rules:
- A server MUST NOT send an envelope larger than its advertised
maxEventBytes, and a client MUST accept envelopes up to that size. - Every owner MUST keep each of its event payloads, with the envelope, within 256 KiB (the floor), or define a reference form in which the event names an object that the client fetches over HTTP.
- Servers need not accept compressed request bodies. A server that receives a
Content-Encodingit doesn't support answers 415core.unsupported_media_type. - A client whose
session.hellowould exceedmaxEventBytessends part of its subscriptions in the hello and the rest insession.subscribemessages.
00 §7.12 lists maxSubscriptions (default 1,000, floor 250) and maxReplayEvents (default 5,000, floor 1,000, with a replay age window of at least 24 h). Rationale: they bound server memory per socket and per resume, and clients need a guaranteed minimum to plan subscriptions and reconnects.
16.3 Limits index
The full limits table of 00 §7.12:
| Limit | Default | Floor | Owner |
|---|---|---|---|
maxRequestBytes |
1 MiB | 256 KiB | 03 |
maxEventBytes |
1 MiB | 256 KiB | 03 |
maxSubscriptions |
1,000 | 250 | 03 |
maxReplayEvents |
5,000 | 1,000 | 03 |
maxMessageBytes |
16 KiB | 8 KiB | 11 |
maxAttachmentBytes |
25 MiB | 8 MiB | 11 |
maxSecureLeaves |
1,000 (at most 65,536) | 100 | 13 |
maxGroupDmParticipants |
25 | 10 | 12 |
maxDmRequestBytes |
64 KiB | 64 KiB | 12 |
maxMlsUploadBytes |
8 MiB (≥ 2,048 × maxSecureLeaves + 65,536) |
3 MiB | 13 |
maxFederationEventBytes |
128 KiB | 128 KiB | 06 |
maxDevices |
30 | 10 | 05 |
maxLinkedProviders |
10 | 2 | 05 |
maxAvatarBytes |
1 MiB | 256 KiB | 05 |
maxBotsPerAccount |
10 | 1 | 05 |
maxBotTokens |
10 | 2 | 05 |
maxPushRegistrationsPerDevice |
4 | 4 | 19 |
17. Test vectors and worked traces
The values in this section were computed and can be checked with any UUID, base64url and SHA-256 implementation.
17.1 UUIDv7 binary form
| String | Binary form (hex, 16 bytes) | Embedded time | Version / variant |
|---|---|---|---|
01938f30-1b2c-7d4e-8f90-a1b2c3d4e5f6 |
01938f301b2c7d4e8f90a1b2c3d4e5f6 |
1733274114860 ms = 2024-12-04T01:01:54.860Z |
7 / 10 (nibble 8) |
01a2424b-2858-73e1-9d1e-5f2a8c7d9e01 |
01a2424b285873e19d1e5f2a8c7d9e01 |
1796408551512 ms = 2026-12-04T18:22:31.512Z |
7 / 10 (nibble 9) |
The first is the mid of the 00 §7.4 example; its binary form is what 14 uses in K_msg.
17.2 Base64url canonical form
| Input | Result |
|---|---|
did q2bS9xVg3m0yJpQe1vT0Aw |
Valid: 22 characters, final character w is in AQgw; decodes to ab66d2f71560de6d3226941ed6f4f403. |
q2bS9xVg3m0yJpQe1vT0Ax |
Invalid: non-canonical. A lenient decoder would produce the same 16 bytes as the line above, which is exactly why it must be rejected. |
q2bS9xVg3m0yJpQe1vT0Aw== |
Invalid: padding. |
ikf NzbLsXh8uDCcd-6MNwXF4W_7noWXFZAfHkxZsRGC9Xs |
Valid: 43 characters, final character s is in AEIMQUYcgkosw048. |
ekid q83vEjRWeJA |
Valid: 11 characters, final character A. |
17.3 Identifier validation
| Value | As | Valid? | Reason |
|---|---|---|---|
ch:01938a11-2b3c-7d4e-8f90-112233445566 |
ctx-ref |
Yes | |
ch:01938A11-2B3C-7D4E-8F90-112233445566 |
ctx-ref |
No | Uppercase hexadecimal |
CH:01938a11-2b3c-7d4e-8f90-112233445566 |
ctx-ref |
No | Prefix is case-sensitive |
ch:01938a11-2b3c-4d4e-8f90-112233445566 |
ctx-ref |
No | Version 4, not 7 |
ch:01938a11-2b3c-7d4e-cf90-112233445566 |
ctx-ref |
No | Variant bits 11 |
dm:q2bS9xVg3m0yJpQe1vT0Aw |
ctx-ref |
Yes | Format only; whether it is the right DM ID is checked by 12 |
gdm:01a2424b-223e-75c3-8123-456789abcdef |
ctx-ref |
Yes | |
me |
stream |
Yes | Not a ctx-ref, so invalid in a {ctx} path |
a.com#2026-12a |
server-kid |
Yes | |
a.com# |
server-kid |
No | Empty key-id |
sv1:sloppyvoice.com:ch:01938a11-2b3c-7d4e-8f90-112233445566:0 |
mls-group-id |
Yes | Format only; 13 fixes the generation rules |
sv1:sloppyvoice.com:ch:01938a11-2b3c-7d4e-8f90-112233445566:01 |
mls-group-id |
No | Leading zero in the generation |
core.invalid_request |
error-code |
Yes | |
mls.epochConflict |
error-code |
No | Uppercase in reason |
voice-dc/1 |
feature |
Yes | |
voice-dc/01 |
feature |
No | Leading zero |
1.0 |
version |
Yes | |
1.00 |
version |
No | Leading zero in the minor version |
"01a2424b-223e-75c3-8123-456789abcdef" and 01a2424b-223e-75c3-8123-456789abcdef |
Idempotency-Key |
Yes | The same key |
abc def |
Idempotency-Key |
No | Space |
17.4 Timestamps
| Value | Producer form? | Consumer result |
|---|---|---|
2026-12-04T10:15:30.123Z |
Yes | 2026-12-04T10:15:30.123Z |
2026-12-04T10:15:30Z |
No | Accepted: 2026-12-04T10:15:30.000Z |
2026-12-04T10:15:30.123456Z |
No | Accepted: 2026-12-04T10:15:30.123Z (truncated) |
2026-12-04T11:15:30.123+01:00 |
No | Accepted: 2026-12-04T10:15:30.123Z |
2026-12-04 10:15:30.123Z |
No | Rejected: not an RFC 3339 date-time |
2026-12-04T10:15:30.123 |
No | Rejected: no offset |
17.5 Paths and problem types
- These three request targets name the same resource (§2.6):
/v1/contexts/ch:01938a11-2b3c-7d4e-8f90-112233445566/messages/v1/contexts/ch%3A01938a11-2b3c-7d4e-8f90-112233445566/messages/v1/contexts/ch%3a01938a11-2b3c-7d4e-8f90-112233445566/messages
/v1/contexts/ch%253A01938a11-2b3c-7d4e-8f90-112233445566/messagesdecodes once to the segmentch%3A01938a11-…, which isn't a validctx-ref: 400core.invalid_request.- The code
core.not_foundhas the problemtypeurn:sloppyv:error:core.not_found.
17.6 Idempotency fingerprints
| Body bytes (UTF-8) | SHA-256 (hex) |
|---|---|
{"name":"Raid night","kind":"voice"} |
ded53961e3d58b0f22a236c185c247df53812db5c9a0ade3f69fc2f09654ce8f |
{"kind":"voice","name":"Raid night"} |
5fd1ba1a0fca2621a6ae08e051bacfff82ad16ce5e27200a5506fd0f66682263 |
Both bodies mean the same thing, but their fingerprints differ, so a retry that re-serializes the body with another member order is answered with 409 core.idempotency_conflict, reason: "mismatch". Clients keep the exact bytes of a request they may retry.
17.7 Resume decisions
Server with maxReplayEvents = 5,000, all events retained for 7 days, the account's access unchanged.
Stream head H |
Client position P |
Outcome |
|---|---|---|
| 4190 | 4190 | ok, no replay; live from 4191 |
| 4190 | 4182 | ok, replayThrough: 4190; replays 4183 to 4190 (8 events) |
| 9120 | 301 | ok, then session.resync_required (gap_too_large, headSeq: 9120) |
| 4190 | 5000 | ok, then session.resync_required (ahead); the client discards its event-derived cached state, but not MLS state or history keys (§7.5) |
| 4190 | 100, where events up to 2000 were sequenced 3 days ago and purged | ok, then session.resync_required (expired) |
17.8 Client stream processing
Stream ch:01938a11-2b3c-7d4e-8f90-112233445566, P = 4182.
| Received | Action | P after |
|---|---|---|
Durable message.created seq 4183 |
Apply | 4183 |
Durable message.created seq 4183 again |
Duplicate; ignore | 4183 |
Ephemeral call.tick |
Apply; P unchanged |
4183 |
Durable x-acme.thing seq 4184 (unknown type) |
Ignore the payload, advance | 4184 |
Durable message.created seq 4186 |
Gap: drop it and further events of this stream; send session.subscribe with resume: {"ch:01938a11-2b3c-7d4e-8f90-112233445566": 4184} |
4184 |
session.subscribed (replayThrough: 4186), then seq 4185 and 4186 |
Apply both | 4186 |
17.9 Reconnect delays
Upper bounds of the random delay (§5.11) for retries n = 0 to 6: 1, 2, 4, 8, 16, 30 and 30 s. Each actual delay is uniform between 0 and the bound, raised to any minimum the close code or retryAfterMs sets.
17.10 A complete connection
C: [WebSocket handshake to wss://chat.sloppyvoice.com/server/v1/events, Sec-WebSocket-Protocol: sloppyv.v1]
S: [101 Switching Protocols, Sec-WebSocket-Protocol: sloppyv.v1]
C: session.hello resume {ch:…5566: 4182, me: 77, community: 301}, subscribe [gdm:…cdef], heads [ch:…eeff]
S: session.ready subscriptions: me ok (replayThrough 79), ch:…5566 ok (replayThrough 4190),
community ok, gdm:…cdef refused (core.not_found), ch:…eeff heads ok
S: session.resync_required {stream: community, reason: gap_too_large, headSeq: 9120}
S: session.heads {ch:…eeff: {headSeq: 88, lastItemSeq: 88}}
S: [me 78, me 79, ch:…5566 4183 … 4190, interleaved; each stream in order]
C: [GET /v1/community, channels and roles; applies community events > 9120 queued meanwhile]
S: session.ping
C: session.pong (re = ping id)
C: session.state {foreground: false} (the user minimized the window)
C: session.reauth {token: <fresh access token>} (after a silent refresh, before authExpiresAt)
S: session.reauthed {authExpiresAt: …} (re = reauth id)
S: session.subscription_ended {stream: ch:…5566, problem: security.account_required}
(the channel became secure; the account is insecure)
S: session.closing {reason: server_shutdown, reconnect: true, retryAfterMs: 12000}
S: [close 1012]
C: [waits 12 s, reconnects with resume positions for me, community and the remaining streams]18. Security considerations
Document 22 holds the whole-system threat model; this section covers the transport.
18.1 Token leakage
Tokens never appear in URLs, so they don't leak through server and proxy logs, Referer headers or browser history (§3.2). They are never cookies, so browsers never attach them automatically. A client sends each token only to the server that issued it, so a malicious remote server never sees a user's home-session token or another server's remote-session token. Servers and clients redact Authorization and session.hello tokens from logs.
A socket stays authenticated only until the expiry of the most recent token presented on it, plus 60 s (§5.3, §5.13). Someone who steals an access token but not the refresh token can't send session.reauth, so a socket they open lasts at most the stolen token's own lifetime (15 minutes for a home access token, 05) plus 60 s. If their socket replaces the real app's socket, the real app reconnects silently once when it knows no other copy of itself is running (§5.12), which replaces the thief's socket in turn; a thief can keep doing that only while the stolen token is valid. Revoking the session (D-017) cuts everything at once: the home server MUST close the sockets of a revoked or ended session at once, and remote servers MUST close them within the 60 s that 06 allows for revocation fan-out. Servers re-check authorization on every delivery (§5.6), not only at subscription time.
18.2 Cross-site request forgery under open CORS
Access-Control-Allow-Origin: * lets any web page call the API, which is what web clients that talk to many servers need (D-026). It is safe only because no request carries ambient authority: there are no cookies, no HTTP authentication caches and no client certificates (§3.2). A malicious page can send requests, but without a token it can do only what an anonymous caller can. JSON bodies need Content-Type: application/json, which forces a preflight. A server MUST NOT accept application/x-www-form-urlencoded, multipart/form-data or text/plain bodies on JSON endpoints (§2.4 answers them with 415), so that a later mistake that introduces ambient credentials still can't be exploited with simple form posts. The browser-navigation and OAuth endpoints of §2.9 are the only ones that accept form bodies. The OAuth endpoints take their credentials (an authorization code with its PKCE verifier, or a refresh token) from the request body, never from a cookie; the browser-navigation endpoints carry 05's transaction cookie, which authorizes no API request and is protected against cross-site posts as 05 defines (SameSite=Lax, a consent token and an Origin check).
18.3 WebSocket hijacking
Cross-site WebSocket hijacking needs a handshake that the browser authenticates automatically with cookies. Here the handshake carries no credentials and the token goes in session.hello (§5.1), so a socket opened by a hostile page receives nothing until it presents a token it doesn't have. Servers don't use Origin for authorization.
18.4 Web clients
A web client keeps its tokens in script-accessible memory. Script injection on the client's origin can steal them, as it can steal keys (00 §5.2, D-065). The strict Content Security Policy and Subresource Integrity rules of 20 are the defence; this document adds no cookies that could be used instead.
18.5 Compression side channels
When compressed and secret data share a compression context with data an attacker controls, the compressed size can reveal the secret (CRIME, BREACH). Therefore:
permessage-deflateis used only with bothserver_no_context_takeoverandclient_no_context_takeover(§5.1 item 6), so every WebSocket message is compressed on its own. One event's content then can't be probed through the size of a later event that the attacker caused (for example a channel post next to DM index entries ornotify.triggered), and the token insession.helloorsession.reauthnever shares a compression context with attacker-chosen data. This is a MUST because browsers give scripts no control over per-message compression. Non-browser clients additionally SHOULD NOT compress messages that carry tokens.- Servers SHOULD NOT apply HTTP response compression to responses that contain tokens or key material.
Content in secure contexts is end-to-end encrypted before it reaches the transport and isn't exposed by compression.
18.6 Revealing what exists
A resource the caller isn't allowed to know about is reported as core.not_found, never core.forbidden, on HTTP and in subscription results (§5.6). Problem objects never describe resources the caller can't see (§10.1). Servers SHOULD keep response times similar for "doesn't exist" and "exists but hidden".
18.7 Denial of service
The transport bounds the work any one client can cause: the 10 s hello timeout, the 75 s idle timeout, maxSubscriptions, maxReplayEvents, per-socket outbound queues with slow-consumer handling (§7.6), request and event size limits (§16), and per-session, per-IP and per-peer rate limits (§15). A server MAY also reject JSON nested more than 64 levels deep with 400 core.invalid_request. A slow client never delays other clients or sequencing (§7.6).
18.8 Integrity of sequencing
TLS protects envelopes in transit. The server that owns a stream is trusted to sequence it: a malicious server can withhold, delay or reorder events, or claim a resync. In insecure contexts this is part of the accepted trust in the server (00 §5.1). In secure contexts it can deny service but can't forge or read content, and MLS epochs and SealedMessage signatures detect tampering with secure content (13, 14). A client that sees a seq gap from an honest server can't be harmed by it, because it repairs the gap by resume (§7.3).
18.9 Replay across access changes
Replay could reveal events sent while a person had no access to a context, for example messages in a group DM sent after they were removed and before they were re-added. §7.4 forbids that replay and forces a resync, after which the owners' HTTP endpoints apply their own visibility rules.
18.10 Idempotency storage
Stored responses contain user data and are protected like that data. Keys are scoped to the caller's account (§14.2), so one user can't retrieve another user's stored response by guessing a key. Responses that carry credentials are never stored (§14.2 item 8).
18.11 Metadata on the socket
Subscriptions, heads subscriptions and the foreground state tell a server which contexts a user follows and when the user is looking at the app. Only the server that hosts those contexts learns this, and it already sees membership and activity (00 §5.4). Clients SHOULD subscribe at level full only to contexts the user is viewing or has open in a call (a call's context MUST stay at full, §7.6), and use heads for the rest. Targeted events such as mls.commit_needed and call.ringing reach a connected session whatever it subscribes to (§7.2 E5), so this economy never loses a ring or a prompt; an owner's duty rule may still prefer sessions that are online for the stream (§1.3). Document 22 lists this in its metadata table.
18.12 TLS
HTTPS only, TLS 1.2 or later with forward secrecy, no TLS compression, early data refused for non-GET requests, and HSTS (§2.2). Certificate errors are never overridable in normal use, because everything in insecure mode, and the authenticity of every server key fetched from /meta, rests on TLS.
19. Open questions
| ID | Question | Recommendation |
|---|---|---|
| OQ-03-2 | Error type URIs are urn:sloppyv:error:<code> (00 §7.1, §7.9). sloppyv isn't an IANA-registered URN namespace, so these are not valid URNs under RFC 8141. |
Keep the value as fixed by 00, because nobody dereferences it and clients key on code, and state in 00 that the string is an opaque identifier, not a registered URN. Reconsider only if the project registers a namespace or owns a stable domain for an https type URI. |
| OQ-03-3 | draft-ietf-httpapi-ratelimit-headers is still an Internet-Draft and its header syntax has changed between revisions. | Pin the revision current at publication in 21's interoperability notes, keep Retry-After and retryAfterMs as the normative signals (as §15 does), and treat RateLimit headers as advisory. |
20. References
20.1 Normative
- RFC 2119, RFC 8174 — requirement key words
- RFC 5234 — ABNF; RFC 7405 — case-sensitive strings in ABNF
- RFC 3339 — date and time on the Internet; RFC 9562 — UUIDs (UUIDv7)
- RFC 3986 — URI generic syntax; RFC 4648 — base64url (§5) and canonical encoding (§3.5)
- RFC 8259 — JSON; RFC 7493 — I-JSON; RFC 6901 — JSON Pointer
- RFC 9110 — HTTP semantics; RFC 9112, RFC 9113, RFC 9114 — HTTP/1.1, HTTP/2, HTTP/3
- RFC 5246 — TLS 1.2; RFC 8446 — TLS 1.3; RFC 9325 — TLS recommendations; RFC 9525 — service identity in TLS; RFC 8470 — early data in HTTP; RFC 6797 — HSTS
- RFC 6455 — WebSocket; RFC 7692 — WebSocket compression; RFC 8441 — WebSocket over HTTP/2; RFC 9220 — WebSocket over HTTP/3
- RFC 6750 — OAuth 2.0 bearer token usage
- RFC 9457 — problem details for HTTP APIs
- RFC 9745 — the
DeprecationHTTP header; RFC 8594 — theSunsetHTTP header - draft-ietf-httpapi-ratelimit-headers —
RateLimitandRateLimit-Policyheader fields - draft-ietf-httpapi-idempotency-key-header — the
Idempotency-Keyheader field - WHATWG Fetch Standard — CORS protocol
00-overview.md— architecture contract, §7 in particularspec/DECISIONS.md— decision log
20.2 Informative
- RFC 8141 — URNs (OQ-03-2)
- RFC 8615 — well-known URIs (used by 02)
- RFC 7638 — JWK thumbprints (format of
ikfanddkf, owned by 04 and 07) - RFC 9420 — MLS (
group_idand handshakes, owned by 13) - WHATWG HTML Standard — SharedWorker; W3C Web Locks API (one socket shared by browser tabs, §5.12)
- CRIME and BREACH compression attacks (§18.5)
- Documents 01, 02, 04 to 22 — owners of the objects, endpoints, events and codes indexed here