You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: trickle/README.md
+13-1Lines changed: 13 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -22,6 +22,8 @@ Publishers POST to /channel-name/seq
22
22
23
23
Subscribers GET to /channel-name/seq
24
24
25
+
Clients can query the next segment seq with GET to /channel-name/next
26
+
25
27
The `channel-name` is any valid HTTP path part.
26
28
27
29
The `seq` is an integer sequence number indicating the segment, and must increase sequentially without gaps.
@@ -48,12 +50,22 @@ Servers may offer some grace with leading sequence numbers to avoid data races,
48
50
49
51
Publishers are responsible for segmenting content (if necessary) and subscribers are responsible for re-assembling content (if necessary)
50
52
51
-
Publishers can POST with `seq=-1` to write to the current server write head. Successful publisher POST responses include `Lp-Trickle-Seq` metadata (HTTP header) with the effective segment index written by the server, which is especially useful when `-1` was used.
53
+
Successful publisher POST responses include `Lp-Trickle-Seq` metadata (HTTP header) with the effective segment index written by the server.
54
+
55
+
If a publisher sends `Lp-Trickle-Reset`, the server treats it as a restart signal for any `seq` value.
56
+
The server closes prior segments to unblock waiting subscribers while still allowing preconnected/ahead segments.
52
57
53
58
Subscribers can initiate a subscribe with a `seq` of -1 to retrieve the most recent publish. With preconnects, the subscriber may be waiting for the *next* publish. For video this allows clients to eg, start streaming at the live edge of the next GOP.
54
59
55
60
Subscribers can retrieve the current `seq` with the `Lp-Trickle-Seq` metadata (HTTP header). This is useful in case `-1` was used to initiate the subscription; the subscribing client can then pre-connect to `Lp-Trickle-Seq + 1`
56
61
62
+
GET `/channel-name/next` returns the next segment seq as plain text in the response body and in the `Lp-Trickle-Latest` response header.
63
+
If the channel does not exist, the server returns 404.
64
+
If the channel is closed, the server also includes `Lp-Trickle-Closed: terminated`.
65
+
66
+
`Lp-Trickle-Seq` from a publisher write using `seq=-1` is not sufficient by itself to drive real-time ordering if writes overlap.
67
+
It is still useful for post-facto mapping/observability, reconciliation after segment close, and debugging dropped/misordered assumptions.
68
+
57
69
Subscribers can initiate a subscribe with a `seq` of -N to get the Nth-from-last segment. (TODO)
58
70
59
71
The server should send subscribers `Lp-Trickle-Size` metadata to indicate the size of the content up until now. This allows clients to know where the live edge is, eg video implementations can decode-and-discard frames up until the edge to achieve immediate playback without waiting for the next segment. (TODO)
0 commit comments