Skip to content

Commit afef082

Browse files
author
Alan Christie
committed
docs: Doc tweak (headers)
1 parent 2ce019f commit afef082

File tree

1 file changed

+31
-4
lines changed

1 file changed

+31
-4
lines changed

README.md

Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -181,10 +181,10 @@ RabbitMQ Topic Queue.
181181
Version 2 uses the `rstream` package and relies on a RabbitMQ stream.
182182

183183
Version 2 also extends messages prior to forwarding them to their socket clients.
184-
It does this by appending the messages's **offset** in the stream (an `integer`)
185-
and the message's **timestamp** (also an `integer`), both of which are provided by
186-
the backing RabbitMQ stream as the messages are received by the Event Stream's consumer.
187-
The **offset** can be used as a unique message identifier.
184+
It does this by appending the messages's **offset** in the stream (an `integer`,
185+
which we refer to as an **ordinal**)), and the message's **timestamp** (also an `integer`),
186+
both of which are provided by the backing RabbitMQ stream as the messages are received
187+
by the Event Stream's consumer. The **offset** can be used as a unique message identifier.
188188

189189
When received as a protobuf string the values are appended to the end of the original
190190
message using `|` as a delimiter. Here is an example, with the message split at the
@@ -209,6 +209,33 @@ for clarity: -
209209
}
210210
}
211211

212+
## Connecting to sockets (historical events)
213+
The streaming service keeps historical events based on a maximum age and file size.
214+
Consequently you can connect to your websocket and retrieve these historical events
215+
as long as they remain in the backend streaming queue. You identify the
216+
start-time of your events by using **headers** in the websocket request for your
217+
stream's **LOCATION**.
218+
219+
If you do not provide any header value your socket will only deliver new events.
220+
221+
You can select the start of your events buy providing either an **ordinal**,
222+
**timestamp**, or **datetime** string.
223+
224+
To stream from a specific **ordinal** (**offset**), provide it as the numerical value
225+
of the header property `X-StreamOffsetFromOrdinal`.
226+
227+
To stream from a specific **timestamp**, provide it as the numerical value
228+
of the header property `X-StreamOffsetFromTimestamp`.
229+
230+
To stream from a specific **datetime**, provide the date/time string as the value
231+
of the header property `X-StreamOffsetFromDatetime`. The datetime string is extremely
232+
flexible and is interpreted by the **python-dateutil** package's `parse` function.
233+
UTC is used as the reference for messages and the string will be interpreted as a
234+
UTC value if it has no timezone specification. For example, if you are in CEST and
235+
it is `13:33` and you want to retrieve times from 13:33 (local time) then you will need
236+
to provide a **datetime** string value that has the time set to
237+
`11:33` (the UTC time for 13:33 CEST) or specify `13:33+02:00`
238+
212239
---
213240

214241
[black]: https://black.readthedocs.io/en/stable

0 commit comments

Comments
 (0)