Skip to content

Commit a66137d

Browse files
committed
docs: clarify HTTP push request/response rules
Co-authored-by: lody <agent@lody.ai>
1 parent f93799e commit a66137d

1 file changed

Lines changed: 12 additions & 6 deletions

File tree

http-push-sse-protocol.md

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,16 @@ The goal is to reuse all message types, fragmentation rules, and semantics from
3838
- Recommended headers:
3939
- `Content-Type: application/octet-stream`
4040
- `Content-Length: <frame size>`
41-
- Push responses MAY return a protocol frame (binary) when the exchange is naturally request/response:
42-
- `JoinRequest``JoinResponseOk` / `JoinError`
43-
- `DocUpdate` / fragments completing a batch → `Ack`
41+
- Response body: either empty or a single protocol frame (binary). If present, servers SHOULD use:
42+
- `Content-Type: application/octet-stream`
43+
44+
In this transport profile, two flows are defined as request/response pairs:
45+
46+
- **Join:** when the client pushes a `JoinRequest`, the server MUST respond in the same HTTP response body with exactly one protocol frame:
47+
- `JoinResponseOk`, or
48+
- `JoinError`.
49+
- **Client-originated updates:** when the client pushes a `DocUpdate` (single frame), the server MUST respond with an `Ack` frame in the same HTTP response body.
50+
- For fragmented updates, the server MUST emit exactly one `Ack` per batch ID; it is RECOMMENDED to return it as the HTTP response to the push that completes the batch (typically the final fragment), or earlier if it can reject immediately.
4451

4552
For other push messages (e.g., `Leave`), the response body can be empty.
4653

@@ -83,7 +90,7 @@ Security note: if the session key is sensitive, prefer cookie/header transport o
8390

8491
### Join handshake (`JoinRequest``JoinResponse*`)
8592

86-
Recommended pattern:
93+
This profile defines the following pattern:
8794

8895
1. Client issues a push with a `JoinRequest` frame.
8996
2. Server responds in the same HTTP response body with:
@@ -95,7 +102,7 @@ Rationale: SSE reconnections can drop in-flight frames; making join responses pa
95102

96103
### Client-originated updates (`DocUpdate*``Ack`)
97104

98-
Recommended pattern:
105+
This profile defines the following pattern:
99106

100107
- For `DocUpdate` (single frame):
101108
- Client pushes `DocUpdate`.
@@ -153,4 +160,3 @@ This profile assumes SSE can disconnect without replay. To recover:
153160

154161
- Works for all CRDT magic types defined in `protocol.md` (including `%ELO` from `protocol-e2ee.md`).
155162
- `%ELO` payload semantics remain unchanged; only the transport encoding differs.
156-

0 commit comments

Comments
 (0)