# ROOMS — share expiring posts and attachments by keypath

Use TLS or WSS. OPEN binds the current connection; anyone with the keypath can
read, write, delete or change retention. Use a fresh, unguessable keypath for
a private group. Attachment URLs contain that keypath; treat them accordingly.

    ROOMS OPEN {"keypath":"team/example","label":"optional display label"}
    ROOMS POST {"meta":{"text":"hello","tags":["note"]}}
    ROOMS GET <post-id>
    ROOMS READ <attachment-post-id> <offset> <length>
    ROOMS SYNC {"limit":20}
    ROOMS SYNC {"page":"<next>"}
    ROOMS SEARCH {"text":"hello","tags":["note"],"after":"<next>"}
    ROOMS FOLLOW {"after":0,"limit":20}
    ROOMS PRESENCE
    ROOMS PRESENCE {"chat":true}
    ROOMS PRESENCE {"after":123,"wait":10}
    ROOMS RETENTION
    ROOMS RETENTION {"seconds":3600}
    ROOMS DELETE <post-id>
    ROOMS CLEAR
    ROOMS LEAVE

SYNC returns `posts`, `next` and a follow `cursor`; finish paging and then FOLLOW.
Changes contain the post ID and operation; GET retrieves the current record.
On `resync:true` take a new snapshot. Presence includes connected count, published
labels and revision; optional wait is up to 25 seconds. Default retention is
72 hours from publication. Room settings accept 1 second through 30 days.
Changing retention applies to posts without a per-post override. CLEAR also
invalidates pending uploads.

READ works on published, unexpired attachments in the open room. Request
1–65536 bytes. Replies contain Base64 `data`, `offset`, actual `length`,
`next_offset`, `size` and `eof`.

Opt-in chat presence adds `participants` (id, name, credential and display_name)
and `participant_id` (null for an unlabeled observer). IDs and duplicate-name
suffixes are local to the room. Ordinary published labels are `unverified`;
`key` in SSH chat means possession of a key, not ownership of the name or
permission to administer the room. The ordinary presence reply is unchanged.

    ROOMS BEGIN {"name":"note.txt","size":5,"meta":{"text":"attachment"}}
    ROOMS PUT <id> <offset> <base64>
    ROOMS PUTBIN <id> <offset> <length>
    ROOMS STATUS <id>
    ROOMS COMMIT <id>

Uploads follow INBOX framing. Reopen the same keypath to resume. GET the post
after COMMIT for the range-capable attachment URL. POST/BEGIN may specify
`retention_seconds`. Limits: 16 MiB/file, 512 posts/uploads and 128 MiB total,
512 configured rooms; 256 most recent changes per room, up to 50 per page.
