|
1 | 1 | import { type Serializer, type WebSocketConfig } from "../../interfaces"; |
2 | 2 |
|
3 | 3 | export interface WebSocketConfigProps { |
| 4 | + /** |
| 5 | + * Streaming API URL for your Mastodon instance. |
| 6 | + * |
| 7 | + * Note that this is often different from the REST API URL. |
| 8 | + * |
| 9 | + * If you are not sure which URL to use, you can obtain it via the following script: |
| 10 | + * |
| 11 | + * @example |
| 12 | + * ```ts |
| 13 | + * import { createRestAPIClient, createStreamingAPIClient } from "masto"; |
| 14 | + * |
| 15 | + * const rest = createRestAPIClient({ |
| 16 | + * url: "https://example.com", |
| 17 | + * }); |
| 18 | + * |
| 19 | + * const instance = await rest.v2.instance.fetch(); |
| 20 | + * |
| 21 | + * const streaming = createStreamingAPIClient({ |
| 22 | + * streamingApiUrl: instance.configuration.urls.streamingApi, |
| 23 | + * }) |
| 24 | + * ``` |
| 25 | + */ |
4 | 26 | readonly streamingApiUrl: string; |
5 | | - readonly retry?: boolean | number; |
| 27 | + |
| 28 | + /** |
| 29 | + * Access token for the streaming API. |
| 30 | + * |
| 31 | + * If it is not provided, you won't be able to use private APIs. |
| 32 | + */ |
6 | 33 | readonly accessToken?: string; |
| 34 | + |
| 35 | + /** |
| 36 | + * Whether to retry the connection when it fails. |
| 37 | + * |
| 38 | + * - If `true`, it will retry indefinitely. |
| 39 | + * - If `false`, it will not retry. |
| 40 | + * - If a number, it will retry that many times. |
| 41 | + * |
| 42 | + * Defaults to `true`. |
| 43 | + */ |
| 44 | + readonly retry?: boolean | number; |
| 45 | + |
| 46 | + /** |
| 47 | + * Whether to use the access token as a query parameter. |
| 48 | + * |
| 49 | + * This is useful when your instance runs an old version of Mastodon that does not support the `Sec-Websocket-Protocols` |
| 50 | + * |
| 51 | + * Defaults to `false`. |
| 52 | + */ |
7 | 53 | readonly useInsecureAccessToken?: boolean; |
8 | 54 | } |
9 | 55 |
|
|
0 commit comments