-
Notifications
You must be signed in to change notification settings - Fork 43
[DRAFT][EDU-1899] Chat JS API references #2681
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
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 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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
90b796c
to
904a90a
Compare
904a90a
to
3bb67a1
Compare
3bb67a1
to
9bcd297
Compare
9bcd297
to
9756e66
Compare
385e10f
to
e039dca
Compare
@@ -0,0 +1,17 @@ | |||
--- |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Like this - keeps error types separate from everything else as its a generic concept.
I would call out explicitly that the type comes from the ably
package and not @ably/chat
- as that's an often missed thing.
Definitely worth a try/catch
example here to show import + usage
|
||
| Property | Description | Type | | ||
| -------- | ----------- | ---- | | ||
| `unsubscribe` | A method to unsubscribe from message events. | `() => Promise<void>` | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| `unsubscribe` | A method to unsubscribe from message events. | `() => Promise<void>` | | |
| `unsubscribe` | A method to unsubscribe from message events. | `() => void` | |
|
||
| Property | Description | Type | | ||
| -------- | ----------- | ---- | | ||
| `unsubscribe` | A method to unsubscribe from events. | `() => Promise<void>` | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| `unsubscribe` | A method to unsubscribe from events. | `() => Promise<void>` | | |
| `unsubscribe` | A method to unsubscribe from events. | `() => void` | |
|
||
It is returned by the following methods: | ||
|
||
* [`room.messages.subscribe()`]()/docs/chat/api/javascript/messages#subscribe) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* [`room.messages.subscribe()`]()/docs/chat/api/javascript/messages#subscribe) | |
* [`room.messages.subscribe()`](/docs/chat/api/javascript/messages#subscribe) |
|
||
## Subscription | ||
|
||
A response object that allows you to control the subscription. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps worth mentioning in "subscribe / unsubscribe - style interfaces"?
|
||
## StatusSubscription | ||
|
||
An interface that represents a subscription to status change events. It also provides a method of cleaning up subscriptions that are no longer needed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"change events, that follow the on/off pattern"? Or something to give context?
|
||
### Returned by | ||
|
||
It is returned by the following methods: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also room.onDiscontinuity
@@ -0,0 +1,81 @@ | |||
--- | |||
title: Subscriptions | |||
meta_description: "Ably Chat JavaScript API references for interfaces that manage the lifecycle of subscriptions." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Like this page, saves lots of repetition across multiple pages
|
||
<Code> | ||
```javascript | ||
const { off } = room.onDiscontinuity((reason: ErrorInfo) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this sort of snippet is an opportunity to show more detail, e.g. - go and call historyBeforeSubscribe
again, etc.
Do we want the API refs to have more contextual bits like this? Looking at examples like React, it feels like a good shout for more complicated cases
@@ -0,0 +1,193 @@ | |||
--- |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we call out the JWT format here?
Description
This PR pulls the Chat JavaScript SDK API reference docs from TypeDoc into MDX.
I have split the content into the following:
I did look at separating out logging into its own section too, but welcome to feedback on that and anything else.
All content has been taken from the existing TypeDocs, plus there are some code examples added in relevant places. I also pulled the relevant authentication pieces in from Pub/Sub to save linking out to that.
Note: I've not added
meta_description
ormeta_keywords
yet until the general format is approved.Checklist