chat docs: update history.mdx for specific use-cases#3124
chat docs: update history.mdx for specific use-cases#3124
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the
WalkthroughThis pull request updates documentation for message history retrieval functionality, adding explicit parameter defaults (start, end, orderBy, limit) and a new section explaining message ordering behavior (newestFirst vs oldestFirst) to clarify API semantics and reduce implementation confusion. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
6f882b7 to
fea3179
Compare
…ault param values
fea3179 to
ef8437c
Compare
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Fix all issues with AI agents
In `@src/pages/docs/chat/rooms/history.mdx`:
- Line 114: The Swift typedoc link contains an extra closing parenthesis; edit
the line referencing historyBeforeSubscribe(withParams:) and remove the trailing
")" from the URL in the If lang="swift" link so the URL matches the intended
typedoc link exactly (keep the displayed label
[`historyBeforeSubscribe(withParams:)`] and only correct the href).
- Line 111: Remove the incorrect inline link on the function name so
`historyBeforeSubscribe()` is plain text and add a separate, clearly worded link
to the ordering guidance (the "understanding-message-ordering" anchor) in the
surrounding sentence; specifically, edit the paragraph that currently contains
[`historyBeforeSubscribe()`](`#understanding-message-ordering`) to render
historyBeforeSubscribe() without a link and include a second sentence or clause
linking to the ordering guidance (e.g., "See the ordering guidance in the
understanding-message-ordering section") so the function name and the ordering
documentation are distinct.
| | orderBy | The order in which to retrieve messages from; either `oldestFirst` or `newestFirst`. **Defaults to `newestFirst`.** | | ||
| | limit | Maximum number of messages to be retrieved per page, up to 1,000. **Defaults to 100.** | | ||
|
|
||
| ### Understanding message ordering <a id="understanding-message-ordering"/> |
There was a problem hiding this comment.
Does this need to be an entire section? At most I would have this as a single sentence, e.g. "Most chat applications will use newestFirst to display messages from newest to oldest"
There was a problem hiding this comment.
This section is required to describe message ordering semantics and subscriber message delivery. Without this documentation, the LLM has repeatedly hallucinated, as referenced in https://ably.atlassian.net/browse/FTF-489
There was a problem hiding this comment.
Sure, we need the information - my question is does it have to be an entire section, or could it literally be a sentence at the end of the previous section?
So the previous section has a table and then a sentence describing things?
There was a problem hiding this comment.
Agree with Andy here - also:
The
orderByparameter determines both which messages are retrieved and their return order:
I think this is a little confusing and the emphasis shouldn't be on which
# Conflicts: # src/pages/docs/chat/rooms/history.mdx
splindsay-92
left a comment
There was a problem hiding this comment.
I think there are still a few comments that need addressing, but everything else is fine for me.
| | orderBy | The order in which to retrieve messages from; either `oldestFirst` or `newestFirst`. **Defaults to `newestFirst`.** | | ||
| | limit | Maximum number of messages to be retrieved per page, up to 1,000. **Defaults to 100.** | | ||
|
|
||
| ### Understanding message ordering <a id="understanding-message-ordering"/> |
There was a problem hiding this comment.
Agree with Andy here - also:
The
orderByparameter determines both which messages are retrieved and their return order:
I think this is a little confusing and the emphasis shouldn't be on which
| ## Retrieve messages sent prior to subscribing <a id="subscribe"/> | ||
|
|
||
| Users can also retrieve historical messages that were sent to a room before the point that they registered a listener by [subscribing](/docs/chat/rooms/messages#subscribe). The order of messages returned is from most recent, to oldest. This is useful for providing conversational context when a user first joins a room, or when they subsequently rejoin it later on. It also ensures that the message history they see is continuous, without any overlap of messages being returned between their subscription and their history call. | ||
| Retrieve historical messages sent before subscribing using `historyBeforeSubscribe()`. Messages are returned in `newestFirst` order. This is useful for providing conversational context when a user joins or rejoins a room, ensuring continuous message history without overlap. |
There was a problem hiding this comment.
Rather than newestFirst order I think this would read better as:
"Messages are returned in order, from the most recent to the oldest."
We avoid people needing to know what the property does then (even if the name is somewhat obvious, admittedly).
| | `end` | Latest time to retrieve messages from, as a unix timestamp in milliseconds. Messages with a timestamp less than this value will be returned. | | ||
| | `limit` | Maximum number of messages to be retrieved per page, up to 1,000. | | ||
| <Aside> | ||
| The `orderBy` parameter is not available for `historyBeforeSubscribe()`. Messages are always returned in `newestFirst` order. |
There was a problem hiding this comment.
As per above: I don't think we need to mention or associate orderBy here as it implies someone would have had to read the whole page to understand this section. We can just say that they're always returned from most recent to oldest.
Summary by CodeRabbit
Documentation
✏️ Tip: You can customize this high-level summary in your review settings.