diff --git a/src/data/nav/chat.ts b/src/data/nav/chat.ts index ad8ca06013..077f5ecd7a 100644 --- a/src/data/nav/chat.ts +++ b/src/data/nav/chat.ts @@ -58,6 +58,10 @@ export default { name: 'SDK setup', link: '/docs/chat/setup', }, + { + name: 'Authentication', + link: '/docs/chat/authentication', + }, { name: 'Connections', link: '/docs/chat/connect', diff --git a/src/data/nav/platform.ts b/src/data/nav/platform.ts index ce1a3b6682..0428b84a06 100644 --- a/src/data/nav/platform.ts +++ b/src/data/nav/platform.ts @@ -301,6 +301,36 @@ export default { }, ], }, + { + name: 'Authentication', + pages: [ + { + name: 'Overview', + link: '/docs/platform/auth', + index: true, + }, + { + name: 'Basic auth', + link: '/docs/platform/auth/basic', + }, + { + name: 'Token auth', + link: '/docs/platform/auth/token', + }, + { + name: 'Token revocation', + link: '/docs/platform/auth/revocation', + }, + { + name: 'Identified clients', + link: '/docs/platform/auth/identified-clients', + }, + { + name: 'Capabilities', + link: '/docs/platform/auth/capabilities', + }, + ], + }, { name: 'Tools', pages: [ diff --git a/src/data/nav/pubsub.ts b/src/data/nav/pubsub.ts index 649d00dd04..f56ef304d1 100644 --- a/src/data/nav/pubsub.ts +++ b/src/data/nav/pubsub.ts @@ -83,36 +83,6 @@ export default { }, ], }, - { - name: 'Authentication', - pages: [ - { - name: 'Overview', - link: '/docs/auth', - index: true, - }, - { - name: 'Basic auth', - link: '/docs/auth/basic', - }, - { - name: 'Token auth', - link: '/docs/auth/token', - }, - { - name: 'Token revocation', - link: '/docs/auth/revocation', - }, - { - name: 'Identified clients', - link: '/docs/auth/identified-clients', - }, - { - name: 'Capabilities', - link: '/docs/auth/capabilities', - }, - ], - }, { name: 'Connections', pages: [ diff --git a/src/data/nav/spaces.ts b/src/data/nav/spaces.ts index bc53734db3..e230c99349 100644 --- a/src/data/nav/spaces.ts +++ b/src/data/nav/spaces.ts @@ -21,6 +21,10 @@ export default { name: 'SDK setup', link: '/docs/spaces/setup', }, + { + name: 'Authentication', + link: '/docs/spaces/authentication', + }, { name: 'React Hooks', link: '/docs/spaces/react', diff --git a/src/pages/docs/api/realtime-sdk.mdx b/src/pages/docs/api/realtime-sdk.mdx index 0c12de70ef..fa88b14b1a 100644 --- a/src/pages/docs/api/realtime-sdk.mdx +++ b/src/pages/docs/api/realtime-sdk.mdx @@ -10,7 +10,7 @@ redirect_from: ## Constructor -The Ably Realtime library constructor is overloaded allowing it to be instantiated using a [`ClientOptions`](#client-options) object, or more simply using a string containing an [API key](/docs/auth/basic) or [Token](/docs/auth/token), as shown below: +The Ably Realtime library constructor is overloaded allowing it to be instantiated using a [`ClientOptions`](#client-options) object, or more simply using a string containing an [API key](/docs/platform/auth/basic) or [Token](/docs/platform/auth/token), as shown below: @@ -116,13 +116,13 @@ The Realtime constructor is used to instantiate the library. The Realtime librar ### Authentication -The Realtime library needs to have credentials to be able to authenticate with the Ably service. Ably supports both Basic and Token based authentication schemes. Read more on [authentication](/docs/auth). +The Realtime library needs to have credentials to be able to authenticate with the Ably service. Ably supports both Basic and Token based authentication schemes. Read more on [authentication](/docs/platform/auth). #### Basic Authentication -You can pass a full-length API key in as `ClientOptions#key` (or just straight into the constructor instead of a `ClientOptions` instance), as obtained from the [application dashboard](https://ably.com/dashboard). Use this option if you wish to use [Basic authentication](/docs/auth/basic), or if you want to be able to [request Ably Tokens](/docs/auth/token) without needing to defer to a separate entity to sign [Ably TokenRequests](/docs/api/realtime-sdk/authentication#token-request). Note that initializing the library with a `key` does not necessarily mean that the library will use Basic auth; it is also able to create and sign Ably [TokenRequests](/docs/api/realtime-sdk/authentication#token-request), and can use token authentication for itself if it needs to or if [`ClientOptions#useTokenAuth`](#client-options) is enabled. +You can pass a full-length API key in as `ClientOptions#key` (or just straight into the constructor instead of a `ClientOptions` instance), as obtained from the [application dashboard](https://ably.com/dashboard). Use this option if you wish to use [Basic authentication](/docs/platform/auth/basic), or if you want to be able to [request Ably Tokens](/docs/platform/auth/token) without needing to defer to a separate entity to sign [Ably TokenRequests](/docs/api/realtime-sdk/authentication#token-request). Note that initializing the library with a `key` does not necessarily mean that the library will use Basic auth; it is also able to create and sign Ably [TokenRequests](/docs/api/realtime-sdk/authentication#token-request), and can use token authentication for itself if it needs to or if [`ClientOptions#useTokenAuth`](#client-options) is enabled. @@ -146,7 +146,7 @@ The [`ClientOptions#token`](#client-options) option takes a `token` string or [t -Read more on [authentication](/docs/auth). +Read more on [authentication](/docs/platform/auth). @@ -844,17 +844,17 @@ Returns a promise. On success, the promise is fulfilled with a [BatchResult](#ba | Property | Description | |----------|-------------| -| key | The full key string, as obtained from the [application dashboard](https://ably.com/dashboard). Use this option if you wish to use Basic authentication, or wish to be able to issue Ably Tokens without needing to defer to a separate entity to sign Ably TokenRequests. Read more about [Basic authentication](/docs/auth/basic)
**Type:** `String` | -| token | An authenticated [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) object, a [`TokenRequest`](/docs/api/realtime-sdk/types#token-request) object, or token string (obtained from the `token` property of a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) component of an Ably TokenRequest response, or a [JSON Web Token](https://tools.ietf.org/html/rfc7519) satisfying [the Ably requirements for JWTs](/docs/auth/token#jwt)). This option is mostly useful for testing: since tokens are short-lived, in production you almost always want to use an authentication method that allows the client library to renew the token automatically when the previous one expires, such as `authUrl` or `authCallback`. Read more about [Token authentication](/docs/auth/token)
**Type:** `String`, `TokenDetails` or `TokenRequest` | -| authCallback | A function with the form `function(tokenParams, callback(err, tokenOrTokenRequest))` which is called when a new token is required. The role of the callback is to obtain a fresh token, one of: an Ably Token string (in plain text format); a signed [`TokenRequest`](/docs/api/realtime-sdk/types#token-request); a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) (in JSON format); an [Ably JWT](/docs/api/realtime-sdk/authentication#ably-jwt). See [our authentication documentation](/docs/auth) for details of the Ably TokenRequest format and associated API calls
**Type:** `Callable` | +| key | The full key string, as obtained from the [application dashboard](https://ably.com/dashboard). Use this option if you wish to use Basic authentication, or wish to be able to issue Ably Tokens without needing to defer to a separate entity to sign Ably TokenRequests. Read more about [Basic authentication](/docs/platform/auth/basic)
**Type:** `String` | +| token | An authenticated [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) object, a [`TokenRequest`](/docs/api/realtime-sdk/types#token-request) object, or token string (obtained from the `token` property of a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) component of an Ably TokenRequest response, or a [JSON Web Token](https://tools.ietf.org/html/rfc7519) satisfying [the Ably requirements for JWTs](/docs/platform/auth/token#jwt)). This option is mostly useful for testing: since tokens are short-lived, in production you almost always want to use an authentication method that allows the client library to renew the token automatically when the previous one expires, such as `authUrl` or `authCallback`. Read more about [Token authentication](/docs/platform/auth/token)
**Type:** `String`, `TokenDetails` or `TokenRequest` | +| authCallback | A function with the form `function(tokenParams, callback(err, tokenOrTokenRequest))` which is called when a new token is required. The role of the callback is to obtain a fresh token, one of: an Ably Token string (in plain text format); a signed [`TokenRequest`](/docs/api/realtime-sdk/types#token-request); a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) (in JSON format); an [Ably JWT](/docs/api/realtime-sdk/authentication#ably-jwt). See [our authentication documentation](/docs/platform/auth) for details of the Ably TokenRequest format and associated API calls
**Type:** `Callable` | | authUrl | A URL that the library may use to obtain a fresh token, one of: an Ably Token string (in plain text format); a signed [`TokenRequest`](/docs/api/realtime-sdk/types#token-request); a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) (in JSON format); an [Ably JWT](/docs/api/realtime-sdk/authentication#ably-jwt). For example, this can be used by a client to obtain signed Ably TokenRequests from an application server
**Type:** `String` | | authMethod | The HTTP verb to use for the request, either `GET` or `POST`
**Type:** `String`
**Default:** `GET` | | authHeaders | A set of key value pair headers to be added to any request made to the `authUrl`. Useful when an application requires these to be added to validate the request or implement the response. If the `authHeaders` object contains an `authorization` key, then `withCredentials` will be set on the xhr request
**Type:** `Object` | | authParams | A set of key value pair params to be added to any request made to the `authUrl`. When the `authMethod` is `GET`, query params are added to the URL, whereas when `authMethod` is `POST`, the params are sent as URL encoded form data. Useful when an application require these to be added to validate the request or implement the response
**Type:** `Object` | -| tokenDetails | An authenticated [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) object (most commonly obtained from an Ably Token Request response). This option is mostly useful for testing: since tokens are short-lived, in production you almost always want to use an authentication method that allows the client library to renew the token automatically when the previous one expires, such as `authUrl` or `authCallback`. Use this option if you wish to use Token authentication. Read more about [Token authentication](/docs/auth/token)
**Type:** `TokenDetails` | +| tokenDetails | An authenticated [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) object (most commonly obtained from an Ably Token Request response). This option is mostly useful for testing: since tokens are short-lived, in production you almost always want to use an authentication method that allows the client library to renew the token automatically when the previous one expires, such as `authUrl` or `authCallback`. Use this option if you wish to use Token authentication. Read more about [Token authentication](/docs/platform/auth/token)
**Type:** `TokenDetails` | | tls | A boolean value, indicating whether or not a TLS ("SSL") secure connection should be used. An insecure connection cannot be used with Basic authentication as it would lead to a possible compromise of the private API key while in transit. [Find out more about TLS](https://faqs.ably.com/are-messages-sent-to-and-received-from-ably-securely-using-tls)
**Type:** `Boolean`
**Default:** true | -| clientId | A client ID, used for identifying this client when publishing messages or for presence purposes. The `clientId` can be any non-empty string. This option is primarily intended to be used in situations where the library is instantiated with a key; note that a `clientId` may also be implicit in a token used to instantiate the library; an error will be raised if a `clientId` specified here conflicts with the `clientId` implicit in the token. [Find out more about client identities](/docs/auth/identified-clients)
**Type:** `String` | -| useTokenAuth | When true, forces [Token authentication](/docs/auth/token) to be used by the library. Please note that if a `clientId` is not specified in the [`ClientOptions`](/docs/api/realtime-sdk/types#client-options) or [`TokenParams`](/docs/api/realtime-sdk/types#token-params), then the Ably Token issued will be [anonymous](https://faqs.ably.com/authenticated-and-identified-clients)
**Type:** `Boolean`
**Default:** false | +| clientId | A client ID, used for identifying this client when publishing messages or for presence purposes. The `clientId` can be any non-empty string. This option is primarily intended to be used in situations where the library is instantiated with a key; note that a `clientId` may also be implicit in a token used to instantiate the library; an error will be raised if a `clientId` specified here conflicts with the `clientId` implicit in the token. [Find out more about client identities](/docs/platform/auth/identified-clients)
**Type:** `String` | +| useTokenAuth | When true, forces [Token authentication](/docs/platform/auth/token) to be used by the library. Please note that if a `clientId` is not specified in the [`ClientOptions`](/docs/api/realtime-sdk/types#client-options) or [`TokenParams`](/docs/api/realtime-sdk/types#token-params), then the Ably Token issued will be [anonymous](https://faqs.ably.com/authenticated-and-identified-clients)
**Type:** `Boolean`
**Default:** false | | endpoint | Enables [enterprise customers](https://ably.com/pricing) to use their own custom endpoints, which support dedicated, isolated clusters and regional message routing and storage constraints. See our [platform customization guide](/docs/platform/account/enterprise-customization) for more details
**Type:** `String`
**Default:** null | | environment | Deprecated, use `endpoint`. Enables [enterprise customers](https://ably.com/pricing) to use their own custom environments, which support dedicated, isolated clusters and regional message routing and storage constraints. See our [platform customization guide](/docs/platform/account/enterprise-customization) for more details
**Type:** `String`
**Default:** null | | idempotentRestPublishing | When true, enables idempotent publishing by assigning a unique message ID client-side, allowing the Ably servers to discard automatic publish retries following a failure such as a network fault. We recommend you enable this by default. In version 1.2 onwards, idempotent publishing for retries will be enabled by default
**Type:** `Boolean`
**Default:** false | @@ -869,7 +869,7 @@ Returns a promise. On success, the promise is fulfilled with a [BatchResult](#ba | transports | An optional array of transports to use, in descending order of preference. In the browser environment the available transports are: `web_socket`, `xhr_polling`The transports available in the Node.js client library are: `web_socket`, `xhr_polling`, `comet`
**Type:** `String[]` | | recover | This option allows a connection to inherit the state of a previous connection that may have existed under a different instance of the Realtime library. This might typically be used by clients of the browser library to ensure connection state can be preserved when the user refreshes the page. A recovery key string can be explicitly provided, or alternatively if a callback function is provided, the client library will automatically persist the recovery key between page reloads and call the callback when the connection is recoverable. The callback is then responsible for confirming whether the connection should be recovered or not. See [connection state recovery](/docs/connect/states) for further information
**Type:** `String`, `Callable`
This option allows a connection to inherit the state of a previous connection that may have existed under a different instance of the library by providing that connection's [`recoveryKey`](/docs/api/realtime-sdk/connection#recovery-key). This might typically be used by clients of an app to ensure connection state can be preserved following a reload. See [connection state recovery](/docs/connect/states) for further information and example code
**Type:** `String`
| | closeOnUnload | When true, the client library will automatically send a close request to Ably whenever the `window beforeunload` event fires. By enabling this option, the close request sent to Ably ensures the connection state will not be retained and all channels associated with the connection will be detached. This is commonly used by developers who want presence leave events to fire immediately i.e. if a user navigates to another page or closes their browser, then enabling this option will result in the presence member leaving immediately. Without this option or an explicit call to the [`close`](/docs/api/realtime-sdk/connection#close) method of the [`Connection object`](/docs/api/realtime-sdk/connection), Ably expects that the abruptly disconnected connection could later be recovered and therefore does not immediately remove the user from presence. Instead, to avoid "twitchy" presence behavior an abruptly disconnected client is removed from channels in which they are present after 15 seconds, and the connection state is retained for two minutes
**Type:** `Boolean`
**Default:** true
| -| queryTime | If true, the library will query the Ably servers for the current time when [issuing TokenRequests](/docs/auth/token) instead of relying on a locally-available time of day. Knowing the time accurately is needed to create valid signed Ably [TokenRequests](/docs/api/realtime-sdk/authentication#request-token), so this option is useful for library instances on auth servers where for some reason the server clock cannot be kept synchronized through normal means, such as an [NTP daemon](https://en.wikipedia.org/wiki/Ntpd). The server is queried for the current time once per client library instance (which stores the offset from the local clock), so if using this option you should avoid instancing a new version of the library for each request
**Type:** `Boolean`
**Default:** false | +| queryTime | If true, the library will query the Ably servers for the current time when [issuing TokenRequests](/docs/platform/auth/token) instead of relying on a locally-available time of day. Knowing the time accurately is needed to create valid signed Ably [TokenRequests](/docs/api/realtime-sdk/authentication#request-token), so this option is useful for library instances on auth servers where for some reason the server clock cannot be kept synchronized through normal means, such as an [NTP daemon](https://en.wikipedia.org/wiki/Ntpd). The server is queried for the current time once per client library instance (which stores the offset from the local clock), so if using this option you should avoid instancing a new version of the library for each request
**Type:** `Boolean`
**Default:** false | | defaultTokenParams | When a [TokenParams](/docs/api/realtime-sdk/types#token-params) object is provided, it will override the client library defaults when issuing new Ably Tokens or Ably TokenRequests
**Type:** [`TokenParams`](/docs/api/realtime-sdk/types#token-params) | | disconnectedRetryTimeout | When the connection enters the `DISCONNECTED` state, after this delay in milliseconds, if the state is still `DISCONNECTED`, the client library will attempt to reconnect automatically
**Type:** `Integer`
**Default:** 15,000ms | | suspendedRetryTimeout | When the connection enters the `SUSPENDED` state, after this delay in milliseconds, if the state is still `SUSPENDED`, the client library will attempt to reconnect automatically
**Type:** `Integer`
**Default:** 30,000ms | @@ -881,17 +881,17 @@ Returns a promise. On success, the promise is fulfilled with a [BatchResult](#ba | Property | Description | |----------|-------------| -| Key | The full key string, as obtained from the [application dashboard](https://ably.com/dashboard). Use this option if you wish to use Basic authentication, or wish to be able to issue Ably Tokens without needing to defer to a separate entity to sign Ably TokenRequests. Read more about [Basic authentication](/docs/auth/basic)
**Type:** `String` | -| Token | An authenticated [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) object, a [`TokenRequest`](/docs/api/realtime-sdk/types#token-request) object, or token string (obtained from the `Token` property of a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) component of an Ably TokenRequest response, or a [JSON Web Token](https://tools.ietf.org/html/rfc7519) satisfying [the Ably requirements for JWTs](/docs/auth/token#jwt)). This option is mostly useful for testing: since tokens are short-lived, in production you almost always want to use an authentication method that allows the client library to renew the token automatically when the previous one expires, such as `AuthUrl` or `AuthCallback`. Read more about [Token authentication](/docs/auth/token)
**Type:** `String`, `TokenDetails` or `TokenRequest` | -| AuthCallback | A function which is called when a new token is required. The role of the callback is to obtain a fresh token, one of: an Ably Token string (in plain text format); a signed [`TokenRequest`](/docs/api/realtime-sdk/types#token-request); a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) (in JSON format); an [Ably JWT](/docs/api/realtime-sdk/authentication#ably-jwt). See [our authentication documentation](/docs/auth) for details of the Ably TokenRequest format and associated API calls
**Type:** `Func>` | +| Key | The full key string, as obtained from the [application dashboard](https://ably.com/dashboard). Use this option if you wish to use Basic authentication, or wish to be able to issue Ably Tokens without needing to defer to a separate entity to sign Ably TokenRequests. Read more about [Basic authentication](/docs/platform/auth/basic)
**Type:** `String` | +| Token | An authenticated [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) object, a [`TokenRequest`](/docs/api/realtime-sdk/types#token-request) object, or token string (obtained from the `Token` property of a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) component of an Ably TokenRequest response, or a [JSON Web Token](https://tools.ietf.org/html/rfc7519) satisfying [the Ably requirements for JWTs](/docs/platform/auth/token#jwt)). This option is mostly useful for testing: since tokens are short-lived, in production you almost always want to use an authentication method that allows the client library to renew the token automatically when the previous one expires, such as `AuthUrl` or `AuthCallback`. Read more about [Token authentication](/docs/platform/auth/token)
**Type:** `String`, `TokenDetails` or `TokenRequest` | +| AuthCallback | A function which is called when a new token is required. The role of the callback is to obtain a fresh token, one of: an Ably Token string (in plain text format); a signed [`TokenRequest`](/docs/api/realtime-sdk/types#token-request); a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) (in JSON format); an [Ably JWT](/docs/api/realtime-sdk/authentication#ably-jwt). See [our authentication documentation](/docs/platform/auth) for details of the Ably TokenRequest format and associated API calls
**Type:** `Func>` | | AuthUrl | A URL that the library may use to obtain a fresh token, one of: an Ably Token string (in plain text format); a signed [`TokenRequest`](/docs/api/realtime-sdk/types#token-request); a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) (in JSON format); an [Ably JWT](/docs/api/realtime-sdk/authentication#ably-jwt). For example, this can be used by a client to obtain signed Ably TokenRequests from an application server
**Type:** `Uri` | | AuthMethod | The HTTP verb to use for the request, either `GET` or `POST`
**Type:** `HttpMethod`
**Default:** `GET` | | AuthHeaders | A set of key value pair headers to be added to any request made to the `AuthUrl`. Useful when an application requires these to be added to validate the request or implement the response
**Type:** `Dictionary` | | AuthParams | A set of key value pair params to be added to any request made to the `AuthUrl`. When the `AuthMethod` is `GET`, query params are added to the URL, whereas when `AuthMethod` is `POST`, the params are sent as URL encoded form data. Useful when an application require these to be added to validate the request or implement the response
**Type:** `Dictionary` | -| TokenDetails | An authenticated [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) object (most commonly obtained from an Ably Token Request response). This option is mostly useful for testing: since tokens are short-lived, in production you almost always want to use an authentication method that allows the client library to renew the token automatically when the previous one expires, such as `AuthUrl` or `AuthCallback`. Use this option if you wish to use Token authentication. Read more about [Token authentication](/docs/auth/token)
**Type:** `TokenDetails` | +| TokenDetails | An authenticated [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) object (most commonly obtained from an Ably Token Request response). This option is mostly useful for testing: since tokens are short-lived, in production you almost always want to use an authentication method that allows the client library to renew the token automatically when the previous one expires, such as `AuthUrl` or `AuthCallback`. Use this option if you wish to use Token authentication. Read more about [Token authentication](/docs/platform/auth/token)
**Type:** `TokenDetails` | | Tls | A boolean value, indicating whether or not a TLS ("SSL") secure connection should be used. An insecure connection cannot be used with Basic authentication as it would lead to a possible compromise of the private API key while in transit. [Find out more about TLS](https://faqs.ably.com/are-messages-sent-to-and-received-from-ably-securely-using-tls)
**Type:** `Boolean`
**Default:** true | -| ClientId | A client ID, used for identifying this client when publishing messages or for presence purposes. The `ClientId` can be any non-empty string. This option is primarily intended to be used in situations where the library is instantiated with a key; note that a `ClientId` may also be implicit in a token used to instantiate the library; an error will be raised if a `ClientId` specified here conflicts with the `ClientId` implicit in the token. [Find out more about client identities](/docs/auth/identified-clients)
**Type:** `String` | -| UseTokenAuth | When true, forces [Token authentication](/docs/auth/token) to be used by the library. Please note that if a `clientId` is not specified in the [`ClientOptions`](/docs/api/realtime-sdk/types#client-options) or [`TokenParams`](/docs/api/realtime-sdk/types#token-params), then the Ably Token issued will be [anonymous](https://faqs.ably.com/authenticated-and-identified-clients)
**Type:** `Boolean`
**Default:** false | +| ClientId | A client ID, used for identifying this client when publishing messages or for presence purposes. The `ClientId` can be any non-empty string. This option is primarily intended to be used in situations where the library is instantiated with a key; note that a `ClientId` may also be implicit in a token used to instantiate the library; an error will be raised if a `ClientId` specified here conflicts with the `ClientId` implicit in the token. [Find out more about client identities](/docs/platform/auth/identified-clients)
**Type:** `String` | +| UseTokenAuth | When true, forces [Token authentication](/docs/platform/auth/token) to be used by the library. Please note that if a `clientId` is not specified in the [`ClientOptions`](/docs/api/realtime-sdk/types#client-options) or [`TokenParams`](/docs/api/realtime-sdk/types#token-params), then the Ably Token issued will be [anonymous](https://faqs.ably.com/authenticated-and-identified-clients)
**Type:** `Boolean`
**Default:** false | | Endpoint | Enables [enterprise customers](https://ably.com/pricing) to use their own custom endpoints, which support dedicated, isolated clusters and regional message routing and storage constraints. See our [platform customization guide](/docs/platform/account/enterprise-customization) for more details
**Type:** `String`
**Default:** null | | Environment | Deprecated, use `endpoint`. Enables [enterprise customers](https://ably.com/pricing) to use their own custom environments, which support dedicated, isolated clusters and regional message routing and storage constraints. See our [platform customization guide](/docs/platform/account/enterprise-customization) for more details
**Type:** `String`
**Default:** null | | IdempotentRestPublishing | When true, enables idempotent publishing by assigning a unique message ID client-side, allowing the Ably servers to discard automatic publish retries following a failure such as a network fault. We recommend you enable this by default. In version 1.2 onwards, idempotent publishing for retries will be enabled by default
**Type:** `Boolean`
**Default:** false | @@ -904,7 +904,7 @@ Returns a promise. On success, the promise is fulfilled with a [BatchResult](#ba | EchoMessages | If false, prevents messages originating from this connection being echoed back on the same connection
**Type:** `Boolean`
**Default:** true | | AutoConnect | By default as soon as the client library is instantiated it will connect to Ably. You can optionally set this to false and explicitly connect to Ably when require using the [`connect`](/docs/api/realtime-sdk/connection#connect) method
**Type:** `Boolean`
**Default:** true | | Recover | This option allows a connection to inherit the state of a previous connection that may have existed under a different instance of the library by providing that connection's [`recoveryKey`](/docs/api/realtime-sdk/connection#recovery-key). This might typically be used by clients of an app to ensure connection state can be preserved following a reload. See [connection state recovery](/docs/connect/states) for further information and example code
**Type:** `String` | -| QueryTime | If true, the library will query the Ably servers for the current time when [issuing TokenRequests](/docs/auth/token) instead of relying on a locally-available time of day. Knowing the time accurately is needed to create valid signed Ably [TokenRequests](/docs/api/realtime-sdk/authentication#request-token), so this option is useful for library instances on auth servers where for some reason the server clock cannot be kept synchronized through normal means, such as an [NTP daemon](https://en.wikipedia.org/wiki/Ntpd). The server is queried for the current time once per client library instance (which stores the offset from the local clock), so if using this option you should avoid instancing a new version of the library for each request
**Type:** `Boolean`
**Default:** false | +| QueryTime | If true, the library will query the Ably servers for the current time when [issuing TokenRequests](/docs/platform/auth/token) instead of relying on a locally-available time of day. Knowing the time accurately is needed to create valid signed Ably [TokenRequests](/docs/api/realtime-sdk/authentication#request-token), so this option is useful for library instances on auth servers where for some reason the server clock cannot be kept synchronized through normal means, such as an [NTP daemon](https://en.wikipedia.org/wiki/Ntpd). The server is queried for the current time once per client library instance (which stores the offset from the local clock), so if using this option you should avoid instancing a new version of the library for each request
**Type:** `Boolean`
**Default:** false | | DefaultTokenParams | When a [TokenParams](/docs/api/realtime-sdk/types#token-params) object is provided, it will override the client library defaults when issuing new Ably Tokens or Ably TokenRequests
**Type:** [`TokenParams`](/docs/api/realtime-sdk/types#token-params) | | DisconnectedRetryTimeout | When the connection enters the `DISCONNECTED` state, after this delay in milliseconds, if the state is still `DISCONNECTED`, the client library will attempt to reconnect automatically
**Type:** `Integer`
**Default:** 15,000ms | | SuspendedRetryTimeout | When the connection enters the `SUSPENDED` state, after this delay in milliseconds, if the state is still `SUSPENDED`, the client library will attempt to reconnect automatically
**Type:** `Integer`
**Default:** 30,000ms | @@ -915,17 +915,17 @@ Returns a promise. On success, the promise is fulfilled with a [BatchResult](#ba | Property | Description | |----------|-------------| -| key | The full key string, as obtained from the [application dashboard](https://ably.com/dashboard). Use this option if you wish to use Basic authentication, or wish to be able to issue Ably Tokens without needing to defer to a separate entity to sign Ably TokenRequests. Read more about [Basic authentication](/docs/auth/basic)
**Type:** `String` | -| token | An authenticated [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) object, a [`TokenRequest`](/docs/api/realtime-sdk/types#token-request) object, or token string (obtained from the `token` property of a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) component of an Ably TokenRequest response, or a [JSON Web Token](https://tools.ietf.org/html/rfc7519) satisfying [the Ably requirements for JWTs](/docs/auth/token#jwt)). This option is mostly useful for testing: since tokens are short-lived, in production you almost always want to use an authentication method that allows the client library to renew the token automatically when the previous one expires, such as `authUrl` or `authCallback`. Read more about [Token authentication](/docs/auth/token)
**Type:** `String`, `TokenDetails` or `TokenRequest` | -| authCallback | A `TokenCallback` instance which is called when a new token is required. The role of the callback is to obtain a fresh token, one of: an Ably Token string (in plain text format); a signed [`TokenRequest`](/docs/api/realtime-sdk/types#token-request); a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) (in JSON format); an [Ably JWT](/docs/api/realtime-sdk/authentication#ably-jwt). See [our authentication documentation](/docs/auth) for details of the Ably TokenRequest format and associated API calls
**Type:** `TokenCallback` | +| key | The full key string, as obtained from the [application dashboard](https://ably.com/dashboard). Use this option if you wish to use Basic authentication, or wish to be able to issue Ably Tokens without needing to defer to a separate entity to sign Ably TokenRequests. Read more about [Basic authentication](/docs/platform/auth/basic)
**Type:** `String` | +| token | An authenticated [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) object, a [`TokenRequest`](/docs/api/realtime-sdk/types#token-request) object, or token string (obtained from the `token` property of a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) component of an Ably TokenRequest response, or a [JSON Web Token](https://tools.ietf.org/html/rfc7519) satisfying [the Ably requirements for JWTs](/docs/platform/auth/token#jwt)). This option is mostly useful for testing: since tokens are short-lived, in production you almost always want to use an authentication method that allows the client library to renew the token automatically when the previous one expires, such as `authUrl` or `authCallback`. Read more about [Token authentication](/docs/platform/auth/token)
**Type:** `String`, `TokenDetails` or `TokenRequest` | +| authCallback | A `TokenCallback` instance which is called when a new token is required. The role of the callback is to obtain a fresh token, one of: an Ably Token string (in plain text format); a signed [`TokenRequest`](/docs/api/realtime-sdk/types#token-request); a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) (in JSON format); an [Ably JWT](/docs/api/realtime-sdk/authentication#ably-jwt). See [our authentication documentation](/docs/platform/auth) for details of the Ably TokenRequest format and associated API calls
**Type:** `TokenCallback` | | authUrl | A URL that the library may use to obtain a fresh token, one of: an Ably Token string (in plain text format); a signed [`TokenRequest`](/docs/api/realtime-sdk/types#token-request); a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) (in JSON format); an [Ably JWT](/docs/api/realtime-sdk/authentication#ably-jwt). For example, this can be used by a client to obtain signed Ably TokenRequests from an application server
**Type:** `String` | | authMethod | The HTTP verb to use for the request, either `GET` or `POST`
**Type:** `String`
**Default:** `GET` | | authHeaders | A set of key value pair headers to be added to any request made to the `authUrl`. Useful when an application requires these to be added to validate the request or implement the response
**Type:** `Param[]` | | authParams | A set of key value pair params to be added to any request made to the `authUrl`. When the `authMethod` is `GET`, query params are added to the URL, whereas when `authMethod` is `POST`, the params are sent as URL encoded form data. Useful when an application require these to be added to validate the request or implement the response
**Type:** `Param[]` | -| tokenDetails | An authenticated [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) object (most commonly obtained from an Ably Token Request response). This option is mostly useful for testing: since tokens are short-lived, in production you almost always want to use an authentication method that allows the client library to renew the token automatically when the previous one expires, such as `authUrl` or `authCallback`. Use this option if you wish to use Token authentication. Read more about [Token authentication](/docs/auth/token)
**Type:** `TokenDetails` | +| tokenDetails | An authenticated [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) object (most commonly obtained from an Ably Token Request response). This option is mostly useful for testing: since tokens are short-lived, in production you almost always want to use an authentication method that allows the client library to renew the token automatically when the previous one expires, such as `authUrl` or `authCallback`. Use this option if you wish to use Token authentication. Read more about [Token authentication](/docs/platform/auth/token)
**Type:** `TokenDetails` | | tls | A boolean value, indicating whether or not a TLS ("SSL") secure connection should be used. An insecure connection cannot be used with Basic authentication as it would lead to a possible compromise of the private API key while in transit. [Find out more about TLS](https://faqs.ably.com/are-messages-sent-to-and-received-from-ably-securely-using-tls)
**Type:** `Boolean`
**Default:** true | -| clientId | A client ID, used for identifying this client when publishing messages or for presence purposes. The `clientId` can be any non-empty string. This option is primarily intended to be used in situations where the library is instantiated with a key; note that a `clientId` may also be implicit in a token used to instantiate the library; an error will be raised if a `clientId` specified here conflicts with the `clientId` implicit in the token. [Find out more about client identities](/docs/auth/identified-clients)
**Type:** `String` | -| useTokenAuth | When true, forces [Token authentication](/docs/auth/token) to be used by the library. Please note that if a `clientId` is not specified in the [`ClientOptions`](/docs/api/realtime-sdk/types#client-options) or [`TokenParams`](/docs/api/realtime-sdk/types#token-params), then the Ably Token issued will be [anonymous](https://faqs.ably.com/authenticated-and-identified-clients)
**Type:** `Boolean`
**Default:** false | +| clientId | A client ID, used for identifying this client when publishing messages or for presence purposes. The `clientId` can be any non-empty string. This option is primarily intended to be used in situations where the library is instantiated with a key; note that a `clientId` may also be implicit in a token used to instantiate the library; an error will be raised if a `clientId` specified here conflicts with the `clientId` implicit in the token. [Find out more about client identities](/docs/platform/auth/identified-clients)
**Type:** `String` | +| useTokenAuth | When true, forces [Token authentication](/docs/platform/auth/token) to be used by the library. Please note that if a `clientId` is not specified in the [`ClientOptions`](/docs/api/realtime-sdk/types#client-options) or [`TokenParams`](/docs/api/realtime-sdk/types#token-params), then the Ably Token issued will be [anonymous](https://faqs.ably.com/authenticated-and-identified-clients)
**Type:** `Boolean`
**Default:** false | | endpoint | Enables [enterprise customers](https://ably.com/pricing) to use their own custom endpoints, which support dedicated, isolated clusters and regional message routing and storage constraints. See our [platform customization guide](/docs/platform/account/enterprise-customization) for more details
**Type:** `String`
**Default:** Null | | environment | Deprecated, use `endpoint`. Enables [enterprise customers](https://ably.com/pricing) to use their own custom environments, which support dedicated, isolated clusters and regional message routing and storage constraints. See our [platform customization guide](/docs/platform/account/enterprise-customization) for more details
**Type:** `String`
**Default:** Null | | idempotentRestPublishing | When true, enables idempotent publishing by assigning a unique message ID client-side, allowing the Ably servers to discard automatic publish retries following a failure such as a network fault. We recommend you enable this by default. In version 1.2 onwards, idempotent publishing for retries will be enabled by default
**Type:** `Boolean`
**Default:** false | @@ -938,7 +938,7 @@ Returns a promise. On success, the promise is fulfilled with a [BatchResult](#ba | echoMessages | If false, prevents messages originating from this connection being echoed back on the same connection
**Type:** `Boolean`
**Default:** true | | autoConnect | By default as soon as the client library is instantiated it will connect to Ably. You can optionally set this to false and explicitly connect to Ably when require using the [`connect`](/docs/api/realtime-sdk/connection#connect) method
**Type:** `Boolean`
**Default:** true | | recover | This option allows a connection to inherit the state of a previous connection that may have existed under a different instance of the library by providing that connection's [`recoveryKey`](/docs/api/realtime-sdk/connection#recovery-key). This might typically be used by clients of an app to ensure connection state can be preserved following a reload. See [connection state recovery](/docs/connect/states) for further information and example code
**Type:** `String` | -| queryTime | If true, the library will query the Ably servers for the current time when [issuing TokenRequests](/docs/auth/token) instead of relying on a locally-available time of day. Knowing the time accurately is needed to create valid signed Ably [TokenRequests](/docs/api/realtime-sdk/authentication#request-token), so this option is useful for library instances on auth servers where for some reason the server clock cannot be kept synchronized through normal means, such as an [NTP daemon](https://en.wikipedia.org/wiki/Ntpd). The server is queried for the current time once per client library instance (which stores the offset from the local clock), so if using this option you should avoid instancing a new version of the library for each request
**Type:** `Boolean`
**Default:** false | +| queryTime | If true, the library will query the Ably servers for the current time when [issuing TokenRequests](/docs/platform/auth/token) instead of relying on a locally-available time of day. Knowing the time accurately is needed to create valid signed Ably [TokenRequests](/docs/api/realtime-sdk/authentication#request-token), so this option is useful for library instances on auth servers where for some reason the server clock cannot be kept synchronized through normal means, such as an [NTP daemon](https://en.wikipedia.org/wiki/Ntpd). The server is queried for the current time once per client library instance (which stores the offset from the local clock), so if using this option you should avoid instancing a new version of the library for each request
**Type:** `Boolean`
**Default:** false | | defaultTokenParams | When a [TokenParams](/docs/api/realtime-sdk/types#token-params) object is provided, it will override the client library defaults when issuing new Ably Tokens or Ably TokenRequests
**Type:** [`TokenParams`](/docs/api/realtime-sdk/types#token-params) | | disconnectedRetryTimeout | When the connection enters the `DISCONNECTED` state, after this delay in milliseconds, if the state is still `DISCONNECTED`, the client library will attempt to reconnect automatically
**Type:** `Integer`
**Default:** 15,000ms | | suspendedRetryTimeout | When the connection enters the `SUSPENDED` state, after this delay in milliseconds, if the state is still `SUSPENDED`, the client library will attempt to reconnect automatically
**Type:** `Integer`
**Default:** 30,000ms | @@ -949,17 +949,17 @@ Returns a promise. On success, the promise is fulfilled with a [BatchResult](#ba | Property | Description | |----------|-------------| -| :key | The full key string, as obtained from the [application dashboard](https://ably.com/dashboard). Use this option if you wish to use Basic authentication, or wish to be able to issue Ably Tokens without needing to defer to a separate entity to sign Ably TokenRequests. Read more about [Basic authentication](/docs/auth/basic)
**Type:** `String` | -| :token | An authenticated [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) object, a [`TokenRequest`](/docs/api/realtime-sdk/types#token-request) object, or token string (obtained from the :token property of a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) component of an Ably TokenRequest response, or a [JSON Web Token](https://tools.ietf.org/html/rfc7519) satisfying [the Ably requirements for JWTs](/docs/auth/token#jwt)). This option is mostly useful for testing: since tokens are short-lived, in production you almost always want to use an authentication method that allows the client library to renew the token automatically when the previous one expires, such as :auth_url or :auth_callback. Read more about [Token authentication](/docs/auth/token)
**Type:** `String`, `TokenDetails` or `TokenRequest` | -| :auth_callback | A proc / lambda (called synchronously in REST and Realtime but does not block EventMachine in the latter) which is called when a new token is required. The role of the callback is to obtain a fresh token, one of: an Ably Token string (in plain text format); a signed [`TokenRequest`](/docs/api/realtime-sdk/types#token-request); a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) (in JSON format); an [Ably JWT](/docs/api/realtime-sdk/authentication#ably-jwt). See [our authentication documentation](/docs/auth) for details of the Ably TokenRequest format and associated API calls
**Type:** `Proc` | +| :key | The full key string, as obtained from the [application dashboard](https://ably.com/dashboard). Use this option if you wish to use Basic authentication, or wish to be able to issue Ably Tokens without needing to defer to a separate entity to sign Ably TokenRequests. Read more about [Basic authentication](/docs/platform/auth/basic)
**Type:** `String` | +| :token | An authenticated [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) object, a [`TokenRequest`](/docs/api/realtime-sdk/types#token-request) object, or token string (obtained from the :token property of a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) component of an Ably TokenRequest response, or a [JSON Web Token](https://tools.ietf.org/html/rfc7519) satisfying [the Ably requirements for JWTs](/docs/platform/auth/token#jwt)). This option is mostly useful for testing: since tokens are short-lived, in production you almost always want to use an authentication method that allows the client library to renew the token automatically when the previous one expires, such as :auth_url or :auth_callback. Read more about [Token authentication](/docs/platform/auth/token)
**Type:** `String`, `TokenDetails` or `TokenRequest` | +| :auth_callback | A proc / lambda (called synchronously in REST and Realtime but does not block EventMachine in the latter) which is called when a new token is required. The role of the callback is to obtain a fresh token, one of: an Ably Token string (in plain text format); a signed [`TokenRequest`](/docs/api/realtime-sdk/types#token-request); a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) (in JSON format); an [Ably JWT](/docs/api/realtime-sdk/authentication#ably-jwt). See [our authentication documentation](/docs/platform/auth) for details of the Ably TokenRequest format and associated API calls
**Type:** `Proc` | | :auth_url | A URL that the library may use to obtain a fresh token, one of: an Ably Token string (in plain text format); a signed [`TokenRequest`](/docs/api/realtime-sdk/types#token-request); a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) (in JSON format); an [Ably JWT](/docs/api/realtime-sdk/authentication#ably-jwt). For example, this can be used by a client to obtain signed Ably TokenRequests from an application server
**Type:** String | | :auth_method | The HTTP verb to use for the request, either `:get` or `:post`
**Type:** `Symbol`
**Default:** `:get` | | :auth_headers | A set of key value pair headers to be added to any request made to the :auth_url. Useful when an application requires these to be added to validate the request or implement the response
**Type:** `Hash` | | :auth_params | A set of key value pair params to be added to any request made to the :auth_url. When the :auth_method is `GET`, query params are added to the URL, whereas when :auth_method is `POST`, the params are sent as URL encoded form data. Useful when an application require these to be added to validate the request or implement the response
**Type:** `Hash` | -| :token_details | An authenticated [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) object (most commonly obtained from an Ably Token Request response). This option is mostly useful for testing: since tokens are short-lived, in production you almost always want to use an authentication method that allows the client library to renew the token automatically when the previous one expires, such as :auth_url or :auth_callback. Use this option if you wish to use Token authentication. Read more about [Token authentication](/docs/auth/token)
**Type:** `TokenDetails` | +| :token_details | An authenticated [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) object (most commonly obtained from an Ably Token Request response). This option is mostly useful for testing: since tokens are short-lived, in production you almost always want to use an authentication method that allows the client library to renew the token automatically when the previous one expires, such as :auth_url or :auth_callback. Use this option if you wish to use Token authentication. Read more about [Token authentication](/docs/platform/auth/token)
**Type:** `TokenDetails` | | :tls | A boolean value, indicating whether or not a TLS ("SSL") secure connection should be used. An insecure connection cannot be used with Basic authentication as it would lead to a possible compromise of the private API key while in transit. [Find out more about TLS](https://faqs.ably.com/are-messages-sent-to-and-received-from-ably-securely-using-tls)
**Type:** `Boolean`
**Default:** true | -| :client_id | A client ID, used for identifying this client when publishing messages or for presence purposes. The `client_id` can be any non-empty string. This option is primarily intended to be used in situations where the library is instantiated with a key; note that a `client_id` may also be implicit in a token used to instantiate the library; an error will be raised if a `client_id` specified here conflicts with the `client_id` implicit in the token. [Find out more about client identities](/docs/auth/identified-clients)
**Type:** `String` | -| :use_token_auth | When true, forces [Token authentication](/docs/auth/token) to be used by the library. Please note that if a `client_id` is not specified in the [`ClientOptions`](/docs/api/realtime-sdk/types#client-options) or [`TokenParams`](/docs/api/realtime-sdk/types#token-params), then the Ably Token issued will be [anonymous](https://faqs.ably.com/authenticated-and-identified-clients)
**Type:** `Boolean`
**Default:** false | +| :client_id | A client ID, used for identifying this client when publishing messages or for presence purposes. The `client_id` can be any non-empty string. This option is primarily intended to be used in situations where the library is instantiated with a key; note that a `client_id` may also be implicit in a token used to instantiate the library; an error will be raised if a `client_id` specified here conflicts with the `client_id` implicit in the token. [Find out more about client identities](/docs/platform/auth/identified-clients)
**Type:** `String` | +| :use_token_auth | When true, forces [Token authentication](/docs/platform/auth/token) to be used by the library. Please note that if a `client_id` is not specified in the [`ClientOptions`](/docs/api/realtime-sdk/types#client-options) or [`TokenParams`](/docs/api/realtime-sdk/types#token-params), then the Ably Token issued will be [anonymous](https://faqs.ably.com/authenticated-and-identified-clients)
**Type:** `Boolean`
**Default:** false | | :endpoint | Enables [enterprise customers](https://ably.com/pricing) to use their own custom endpoints, which support dedicated, isolated clusters and regional message routing and storage constraints. See our [platform customization guide](/docs/platform/account/enterprise-customization) for more details
**Type:** `String`
**Default:** nil | | :environment | Deprecated, use `endpoint`. Enables [enterprise customers](https://ably.com/pricing) to use their own custom environments, which support dedicated, isolated clusters and regional message routing and storage constraints. See our [platform customization guide](/docs/platform/account/enterprise-customization) for more details
**Type:** `String`
**Default:** nil | | :idempotent_rest_publishing | When true, enables idempotent publishing by assigning a unique message ID client-side, allowing the Ably servers to discard automatic publish retries following a failure such as a network fault. We recommend you enable this by default. In version 1.2 onwards, idempotent publishing for retries will be enabled by default
**Type:** `Boolean`
**Default:** false | @@ -972,7 +972,7 @@ Returns a promise. On success, the promise is fulfilled with a [BatchResult](#ba | :echo_messages | If false, prevents messages originating from this connection being echoed back on the same connection
**Type:** `Boolean`
**Default:** true | | :auto_connect | By default as soon as the client library is instantiated it will connect to Ably. You can optionally set this to false and explicitly connect to Ably when require using the [`connect`](/docs/api/realtime-sdk/connection#connect) method
**Type:** `Boolean`
**Default:** true | | :recover | This option allows a connection to inherit the state of a previous connection that may have existed under a different instance of the library by providing that connection's [`recovery_key`](/docs/api/realtime-sdk/connection#recovery-key). This might typically be used by clients of an app to ensure connection state can be preserved following a reload. See [connection state recovery](/docs/connect/states) for further information and example code
**Type:** `String` | -| :query_time | If true, the library will query the Ably servers for the current time when [issuing TokenRequests](/docs/auth/token) instead of relying on a locally-available time of day. Knowing the time accurately is needed to create valid signed Ably [TokenRequests](/docs/api/realtime-sdk/authentication#request-token), so this option is useful for library instances on auth servers where for some reason the server clock cannot be kept synchronized through normal means, such as an [NTP daemon](https://en.wikipedia.org/wiki/Ntpd). The server is queried for the current time once per client library instance (which stores the offset from the local clock), so if using this option you should avoid instancing a new version of the library for each request
**Type:** `Boolean`
**Default:** false | +| :query_time | If true, the library will query the Ably servers for the current time when [issuing TokenRequests](/docs/platform/auth/token) instead of relying on a locally-available time of day. Knowing the time accurately is needed to create valid signed Ably [TokenRequests](/docs/api/realtime-sdk/authentication#request-token), so this option is useful for library instances on auth servers where for some reason the server clock cannot be kept synchronized through normal means, such as an [NTP daemon](https://en.wikipedia.org/wiki/Ntpd). The server is queried for the current time once per client library instance (which stores the offset from the local clock), so if using this option you should avoid instancing a new version of the library for each request
**Type:** `Boolean`
**Default:** false | | :default_token_params | When a [TokenParams](/docs/api/realtime-sdk/types#token-params) object is provided, it will override the client library defaults when issuing new Ably Tokens or Ably TokenRequests
**Type:** [`TokenParams`](/docs/api/realtime-sdk/types#token-params) | | :disconnected_retry_timeout | When the connection enters the `DISCONNECTED` state, after this delay in seconds, if the state is still `DISCONNECTED`, the client library will attempt to reconnect automatically
**Type:** Integer
**Default:** 15s | | :suspended_retry_timeout | When the connection enters the `SUSPENDED` state, after this delay in seconds, if the state is still `SUSPENDED`, the client library will attempt to reconnect automatically
**Type:** Integer
**Default:** 30s | @@ -983,17 +983,17 @@ Returns a promise. On success, the promise is fulfilled with a [BatchResult](#ba | Property | Description | |----------|-------------| -| key | The full key string, as obtained from the [application dashboard](https://ably.com/dashboard). Use this option if you wish to use Basic authentication, or wish to be able to issue Ably Tokens without needing to defer to a separate entity to sign Ably TokenRequests. Read more about [Basic authentication](/docs/auth/basic)
**Type:** `String` | -| token | An authenticated [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) object, a [`TokenRequest`](/docs/api/realtime-sdk/types#token-request) object, or token string (obtained from the `token` property of a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) component of an Ably TokenRequest response, or a [JSON Web Token](https://tools.ietf.org/html/rfc7519) satisfying [the Ably requirements for JWTs](/docs/auth/token#jwt)). This option is mostly useful for testing: since tokens are short-lived, in production you almost always want to use an authentication method that allows the client library to renew the token automatically when the previous one expires, such as `authUrl` or `authCallback`. Read more about [Token authentication](/docs/auth/token)
**Type:** `String`, `TokenDetails` or `TokenRequest` | -| authCallback | A function which is called when a new token is required. The role of the callback is to obtain a fresh token, one of: an Ably Token string (in plain text format); a signed [`TokenRequest`](/docs/api/realtime-sdk/types#token-request); a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) (in JSON format); an [Ably JWT](/docs/api/realtime-sdk/authentication#ably-jwt). See [our authentication documentation](/docs/auth) for details of the Ably TokenRequest format and associated API calls
**Type:** `Callable` | +| key | The full key string, as obtained from the [application dashboard](https://ably.com/dashboard). Use this option if you wish to use Basic authentication, or wish to be able to issue Ably Tokens without needing to defer to a separate entity to sign Ably TokenRequests. Read more about [Basic authentication](/docs/platform/auth/basic)
**Type:** `String` | +| token | An authenticated [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) object, a [`TokenRequest`](/docs/api/realtime-sdk/types#token-request) object, or token string (obtained from the `token` property of a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) component of an Ably TokenRequest response, or a [JSON Web Token](https://tools.ietf.org/html/rfc7519) satisfying [the Ably requirements for JWTs](/docs/platform/auth/token#jwt)). This option is mostly useful for testing: since tokens are short-lived, in production you almost always want to use an authentication method that allows the client library to renew the token automatically when the previous one expires, such as `authUrl` or `authCallback`. Read more about [Token authentication](/docs/platform/auth/token)
**Type:** `String`, `TokenDetails` or `TokenRequest` | +| authCallback | A function which is called when a new token is required. The role of the callback is to obtain a fresh token, one of: an Ably Token string (in plain text format); a signed [`TokenRequest`](/docs/api/realtime-sdk/types#token-request); a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) (in JSON format); an [Ably JWT](/docs/api/realtime-sdk/authentication#ably-jwt). See [our authentication documentation](/docs/platform/auth) for details of the Ably TokenRequest format and associated API calls
**Type:** `Callable` | | authUrl | A URL that the library may use to obtain a fresh token, one of: an Ably Token string (in plain text format); a signed [`TokenRequest`](/docs/api/realtime-sdk/types#token-request); a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) (in JSON format); an [Ably JWT](/docs/api/realtime-sdk/authentication#ably-jwt). For example, this can be used by a client to obtain signed Ably TokenRequests from an application server
**Type:** `NSURL` | | authMethod | The HTTP verb to use for the request, either `GET` or `POST`
**Type:** `String`
**Default:** `GET` | | authHeaders | A set of key value pair headers to be added to any request made to the `authUrl`. Useful when an application requires these to be added to validate the request or implement the response
**Type:** `Object` | | authParams | A set of key value pair params to be added to any request made to the `authUrl`. When the `authMethod` is `GET`, query params are added to the URL, whereas when `authMethod` is `POST`, the params are sent as URL encoded form data. Useful when an application require these to be added to validate the request or implement the response
**Type:** `[NSURLQueryItem]/Array` | -| tokenDetails | An authenticated [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) object (most commonly obtained from an Ably Token Request response). This option is mostly useful for testing: since tokens are short-lived, in production you almost always want to use an authentication method that allows the client library to renew the token automatically when the previous one expires, such as `authUrl` or `authCallback`. Use this option if you wish to use Token authentication. Read more about [Token authentication](/docs/auth/token)
**Type:** `TokenDetails` | +| tokenDetails | An authenticated [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) object (most commonly obtained from an Ably Token Request response). This option is mostly useful for testing: since tokens are short-lived, in production you almost always want to use an authentication method that allows the client library to renew the token automatically when the previous one expires, such as `authUrl` or `authCallback`. Use this option if you wish to use Token authentication. Read more about [Token authentication](/docs/platform/auth/token)
**Type:** `TokenDetails` | | tls | A boolean value, indicating whether or not a TLS ("SSL") secure connection should be used. An insecure connection cannot be used with Basic authentication as it would lead to a possible compromise of the private API key while in transit. [Find out more about TLS](https://faqs.ably.com/are-messages-sent-to-and-received-from-ably-securely-using-tls)
**Type:** `Boolean`
**Default:** true | -| clientId | A client ID, used for identifying this client when publishing messages or for presence purposes. The `clientId` can be any non-empty string. This option is primarily intended to be used in situations where the library is instantiated with a key; note that a `clientId` may also be implicit in a token used to instantiate the library; an error will be raised if a `clientId` specified here conflicts with the `clientId` implicit in the token. [Find out more about client identities](/docs/auth/identified-clients)
**Type:** `String` | -| useTokenAuth | When true, forces [Token authentication](/docs/auth/token) to be used by the library. Please note that if a `clientId` is not specified in the [`ClientOptions`](/docs/api/realtime-sdk/types#client-options) or [`TokenParams`](/docs/api/realtime-sdk/types#token-params), then the Ably Token issued will be [anonymous](https://faqs.ably.com/authenticated-and-identified-clients)
**Type:** `Boolean`
**Default:** false | +| clientId | A client ID, used for identifying this client when publishing messages or for presence purposes. The `clientId` can be any non-empty string. This option is primarily intended to be used in situations where the library is instantiated with a key; note that a `clientId` may also be implicit in a token used to instantiate the library; an error will be raised if a `clientId` specified here conflicts with the `clientId` implicit in the token. [Find out more about client identities](/docs/platform/auth/identified-clients)
**Type:** `String` | +| useTokenAuth | When true, forces [Token authentication](/docs/platform/auth/token) to be used by the library. Please note that if a `clientId` is not specified in the [`ClientOptions`](/docs/api/realtime-sdk/types#client-options) or [`TokenParams`](/docs/api/realtime-sdk/types#token-params), then the Ably Token issued will be [anonymous](https://faqs.ably.com/authenticated-and-identified-clients)
**Type:** `Boolean`
**Default:** false | | endpoint | Enables [enterprise customers](https://ably.com/pricing) to use their own custom endpoints, which support dedicated, isolated clusters and regional message routing and storage constraints. See our [platform customization guide](/docs/platform/account/enterprise-customization) for more details
**Type:** `String`
**Default:** nil | | environment | Deprecated, use `endpoint`. Enables [enterprise customers](https://ably.com/pricing) to use their own custom environments, which support dedicated, isolated clusters and regional message routing and storage constraints. See our [platform customization guide](/docs/platform/account/enterprise-customization) for more details
**Type:** `String`
**Default:** nil | | idempotentRestPublishing | When true, enables idempotent publishing by assigning a unique message ID client-side, allowing the Ably servers to discard automatic publish retries following a failure such as a network fault. We recommend you enable this by default. In version 1.2 onwards, idempotent publishing for retries will be enabled by default
**Type:** `Boolean`
**Default:** false | @@ -1007,7 +1007,7 @@ Returns a promise. On success, the promise is fulfilled with a [BatchResult](#ba | echoMessages | If false, prevents messages originating from this connection being echoed back on the same connection
**Type:** `Boolean`
**Default:** true | | autoConnect | By default as soon as the client library is instantiated it will connect to Ably. You can optionally set this to false and explicitly connect to Ably when require using the [`connect`](/docs/api/realtime-sdk/connection#connect) method
**Type:** `Boolean`
**Default:** true | | recover | This option allows a connection to inherit the state of a previous connection that may have existed under a different instance of the library by providing that connection's [`recoveryKey`](/docs/api/realtime-sdk/connection#recovery-key). This might typically be used by clients of an app to ensure connection state can be preserved following a reload. See [connection state recovery](/docs/connect/states) for further information and example code
**Type:** `String` | -| queryTime | If true, the library will query the Ably servers for the current time when [issuing TokenRequests](/docs/auth/token) instead of relying on a locally-available time of day. Knowing the time accurately is needed to create valid signed Ably [TokenRequests](/docs/api/realtime-sdk/authentication#request-token), so this option is useful for library instances on auth servers where for some reason the server clock cannot be kept synchronized through normal means, such as an [NTP daemon](https://en.wikipedia.org/wiki/Ntpd). The server is queried for the current time once per client library instance (which stores the offset from the local clock), so if using this option you should avoid instancing a new version of the library for each request
**Type:** `Boolean`
**Default:** false | +| queryTime | If true, the library will query the Ably servers for the current time when [issuing TokenRequests](/docs/platform/auth/token) instead of relying on a locally-available time of day. Knowing the time accurately is needed to create valid signed Ably [TokenRequests](/docs/api/realtime-sdk/authentication#request-token), so this option is useful for library instances on auth servers where for some reason the server clock cannot be kept synchronized through normal means, such as an [NTP daemon](https://en.wikipedia.org/wiki/Ntpd). The server is queried for the current time once per client library instance (which stores the offset from the local clock), so if using this option you should avoid instancing a new version of the library for each request
**Type:** `Boolean`
**Default:** false | | defaultTokenParams | When a [TokenParams](/docs/api/realtime-sdk/types#token-params) object is provided, it will override the client library defaults when issuing new Ably Tokens or Ably TokenRequests
**Type:** [`TokenParams`](/docs/api/realtime-sdk/types#token-params) | | disconnectedRetryTimeout | When the connection enters the `DISCONNECTED` state, after this delay as a `NSTimeInterval`, if the state is still `DISCONNECTED`, the client library will attempt to reconnect automatically
**Type:** `NSTimeInterval`
**Default:** 15,000ms | | suspendedRetryTimeout | When the connection enters the `SUSPENDED` state, after this delay as a `NSTimeInterval`, if the state is still `SUSPENDED`, the client library will attempt to reconnect automatically
**Type:** `NSTimeInterval`
**Default:** 30,000ms | @@ -1018,17 +1018,17 @@ Returns a promise. On success, the promise is fulfilled with a [BatchResult](#ba | Property | Description | |----------|-------------| -| key | The full key string, as obtained from the [application dashboard](https://ably.com/dashboard). Use this option if you wish to use Basic authentication, or wish to be able to issue Ably Tokens without needing to defer to a separate entity to sign Ably TokenRequests. Read more about [Basic authentication](/docs/auth/basic)
**Type:** `String` | -| token | An authenticated [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) object, a [`TokenRequest`](/docs/api/realtime-sdk/types#token-request) object, or token string (obtained from the `token` property of a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) component of an Ably TokenRequest response, or a [JSON Web Token](https://tools.ietf.org/html/rfc7519) satisfying [the Ably requirements for JWTs](/docs/auth/token#jwt)). This option is mostly useful for testing: since tokens are short-lived, in production you almost always want to use an authentication method that allows the client library to renew the token automatically when the previous one expires, such as `authUrl` or `authCallback`. Read more about [Token authentication](/docs/auth/token)
**Type:** `String`, `TokenDetails` or `TokenRequest` | -| authCallback | A function which is called when a new token is required. The role of the callback is to obtain a fresh token, one of: an Ably Token string (in plain text format); a signed [`TokenRequest`](/docs/api/realtime-sdk/types#token-request); a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) (in JSON format); an [Ably JWT](/docs/api/realtime-sdk/authentication#ably-jwt). See [our authentication documentation](/docs/auth) for details of the Ably TokenRequest format and associated API calls
**Type:** `Callable` | +| key | The full key string, as obtained from the [application dashboard](https://ably.com/dashboard). Use this option if you wish to use Basic authentication, or wish to be able to issue Ably Tokens without needing to defer to a separate entity to sign Ably TokenRequests. Read more about [Basic authentication](/docs/platform/auth/basic)
**Type:** `String` | +| token | An authenticated [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) object, a [`TokenRequest`](/docs/api/realtime-sdk/types#token-request) object, or token string (obtained from the `token` property of a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) component of an Ably TokenRequest response, or a [JSON Web Token](https://tools.ietf.org/html/rfc7519) satisfying [the Ably requirements for JWTs](/docs/platform/auth/token#jwt)). This option is mostly useful for testing: since tokens are short-lived, in production you almost always want to use an authentication method that allows the client library to renew the token automatically when the previous one expires, such as `authUrl` or `authCallback`. Read more about [Token authentication](/docs/platform/auth/token)
**Type:** `String`, `TokenDetails` or `TokenRequest` | +| authCallback | A function which is called when a new token is required. The role of the callback is to obtain a fresh token, one of: an Ably Token string (in plain text format); a signed [`TokenRequest`](/docs/api/realtime-sdk/types#token-request); a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) (in JSON format); an [Ably JWT](/docs/api/realtime-sdk/authentication#ably-jwt). See [our authentication documentation](/docs/platform/auth) for details of the Ably TokenRequest format and associated API calls
**Type:** `Callable` | | authUrl | A URL that the library may use to obtain a fresh token, one of: an Ably Token string (in plain text format); a signed [`TokenRequest`](/docs/api/realtime-sdk/types#token-request); a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) (in JSON format); an [Ably JWT](/docs/api/realtime-sdk/authentication#ably-jwt). For example, this can be used by a client to obtain signed Ably TokenRequests from an application server
**Type:** `NSURL` | | authMethod | The HTTP verb to use for the request, either `GET` or `POST`
**Type:** `String`
**Default:** `GET` | | authHeaders | A set of key value pair headers to be added to any request made to the `authUrl`. Useful when an application requires these to be added to validate the request or implement the response
**Type:** `Object` | | authParams | A set of key value pair params to be added to any request made to the `authUrl`. When the `authMethod` is `GET`, query params are added to the URL, whereas when `authMethod` is `POST`, the params are sent as URL encoded form data. Useful when an application require these to be added to validate the request or implement the response
**Type:** `NSArray` | -| tokenDetails | An authenticated [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) object (most commonly obtained from an Ably Token Request response). This option is mostly useful for testing: since tokens are short-lived, in production you almost always want to use an authentication method that allows the client library to renew the token automatically when the previous one expires, such as `authUrl` or `authCallback`. Use this option if you wish to use Token authentication. Read more about [Token authentication](/docs/auth/token)
**Type:** `TokenDetails` | +| tokenDetails | An authenticated [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) object (most commonly obtained from an Ably Token Request response). This option is mostly useful for testing: since tokens are short-lived, in production you almost always want to use an authentication method that allows the client library to renew the token automatically when the previous one expires, such as `authUrl` or `authCallback`. Use this option if you wish to use Token authentication. Read more about [Token authentication](/docs/platform/auth/token)
**Type:** `TokenDetails` | | tls | A boolean value, indicating whether or not a TLS ("SSL") secure connection should be used. An insecure connection cannot be used with Basic authentication as it would lead to a possible compromise of the private API key while in transit. [Find out more about TLS](https://faqs.ably.com/are-messages-sent-to-and-received-from-ably-securely-using-tls)
**Type:** `Boolean`
**Default:** true | -| clientId | A client ID, used for identifying this client when publishing messages or for presence purposes. The `clientId` can be any non-empty string. This option is primarily intended to be used in situations where the library is instantiated with a key; note that a `clientId` may also be implicit in a token used to instantiate the library; an error will be raised if a `clientId` specified here conflicts with the `clientId` implicit in the token. [Find out more about client identities](/docs/auth/identified-clients)
**Type:** `String` | -| useTokenAuth | When true, forces [Token authentication](/docs/auth/token) to be used by the library. Please note that if a `clientId` is not specified in the [`ClientOptions`](/docs/api/realtime-sdk/types#client-options) or [`TokenParams`](/docs/api/realtime-sdk/types#token-params), then the Ably Token issued will be [anonymous](https://faqs.ably.com/authenticated-and-identified-clients)
**Type:** `Boolean`
**Default:** false | +| clientId | A client ID, used for identifying this client when publishing messages or for presence purposes. The `clientId` can be any non-empty string. This option is primarily intended to be used in situations where the library is instantiated with a key; note that a `clientId` may also be implicit in a token used to instantiate the library; an error will be raised if a `clientId` specified here conflicts with the `clientId` implicit in the token. [Find out more about client identities](/docs/platform/auth/identified-clients)
**Type:** `String` | +| useTokenAuth | When true, forces [Token authentication](/docs/platform/auth/token) to be used by the library. Please note that if a `clientId` is not specified in the [`ClientOptions`](/docs/api/realtime-sdk/types#client-options) or [`TokenParams`](/docs/api/realtime-sdk/types#token-params), then the Ably Token issued will be [anonymous](https://faqs.ably.com/authenticated-and-identified-clients)
**Type:** `Boolean`
**Default:** false | | endpoint | Enables [enterprise customers](https://ably.com/pricing) to use their own custom endpoints, which support dedicated, isolated clusters and regional message routing and storage constraints. See our [platform customization guide](/docs/platform/account/enterprise-customization) for more details
**Type:** `String`
**Default:** nil | | environment | Deprecated, use `endpoint`. Enables [enterprise customers](https://ably.com/pricing) to use their own custom environments, which support dedicated, isolated clusters and regional message routing and storage constraints. See our [platform customization guide](/docs/platform/account/enterprise-customization) for more details
**Type:** `String`
**Default:** nil | | idempotentRestPublishing | When true, enables idempotent publishing by assigning a unique message ID client-side, allowing the Ably servers to discard automatic publish retries following a failure such as a network fault. We recommend you enable this by default. In version 1.2 onwards, idempotent publishing for retries will be enabled by default
**Type:** `Boolean`
**Default:** false | @@ -1042,7 +1042,7 @@ Returns a promise. On success, the promise is fulfilled with a [BatchResult](#ba | echoMessages | If false, prevents messages originating from this connection being echoed back on the same connection
**Type:** `Boolean`
**Default:** true | | autoConnect | By default as soon as the client library is instantiated it will connect to Ably. You can optionally set this to false and explicitly connect to Ably when require using the [`connect`](/docs/api/realtime-sdk/connection#connect) method
**Type:** `Boolean`
**Default:** true | | recover | This option allows a connection to inherit the state of a previous connection that may have existed under a different instance of the library by providing that connection's [`recoveryKey`](/docs/api/realtime-sdk/connection#recovery-key). This might typically be used by clients of an app to ensure connection state can be preserved following a reload. See [connection state recovery](/docs/connect/states) for further information and example code
**Type:** `String` | -| queryTime | If true, the library will query the Ably servers for the current time when [issuing TokenRequests](/docs/auth/token) instead of relying on a locally-available time of day. Knowing the time accurately is needed to create valid signed Ably [TokenRequests](/docs/api/realtime-sdk/authentication#request-token), so this option is useful for library instances on auth servers where for some reason the server clock cannot be kept synchronized through normal means, such as an [NTP daemon](https://en.wikipedia.org/wiki/Ntpd). The server is queried for the current time once per client library instance (which stores the offset from the local clock), so if using this option you should avoid instancing a new version of the library for each request
**Type:** `Boolean`
**Default:** false | +| queryTime | If true, the library will query the Ably servers for the current time when [issuing TokenRequests](/docs/platform/auth/token) instead of relying on a locally-available time of day. Knowing the time accurately is needed to create valid signed Ably [TokenRequests](/docs/api/realtime-sdk/authentication#request-token), so this option is useful for library instances on auth servers where for some reason the server clock cannot be kept synchronized through normal means, such as an [NTP daemon](https://en.wikipedia.org/wiki/Ntpd). The server is queried for the current time once per client library instance (which stores the offset from the local clock), so if using this option you should avoid instancing a new version of the library for each request
**Type:** `Boolean`
**Default:** false | | defaultTokenParams | When a [TokenParams](/docs/api/realtime-sdk/types#token-params) object is provided, it will override the client library defaults when issuing new Ably Tokens or Ably TokenRequests
**Type:** [`TokenParams`](/docs/api/realtime-sdk/types#token-params) | | disconnectedRetryTimeout | When the connection enters the `DISCONNECTED` state, after this delay as a `NSTimeInterval`, if the state is still `DISCONNECTED`, the client library will attempt to reconnect automatically
**Type:** `NSTimeInterval`
**Default:** 15,000ms | | suspendedRetryTimeout | When the connection enters the `SUSPENDED` state, after this delay as a `NSTimeInterval`, if the state is still `SUSPENDED`, the client library will attempt to reconnect automatically
**Type:** `NSTimeInterval`
**Default:** 30,000ms | @@ -1053,17 +1053,17 @@ Returns a promise. On success, the promise is fulfilled with a [BatchResult](#ba | Property | Description | |----------|-------------| -| key | The full key string, as obtained from the [application dashboard](https://ably.com/dashboard). Use this option if you wish to use Basic authentication, or wish to be able to issue Ably Tokens without needing to defer to a separate entity to sign Ably TokenRequests. Read more about [Basic authentication](/docs/auth/basic)
**Type:** `String` | -| token | An authenticated [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) object, a [`TokenRequest`](/docs/api/realtime-sdk/types#token-request) object, or token string (obtained from the `token` property of a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) component of an Ably TokenRequest response, or a [JSON Web Token](https://tools.ietf.org/html/rfc7519) satisfying [the Ably requirements for JWTs](/docs/auth/token#jwt)). This option is mostly useful for testing: since tokens are short-lived, in production you almost always want to use an authentication method that allows the client library to renew the token automatically when the previous one expires, such as `authUrl` or `authCallback`. Read more about [Token authentication](/docs/auth/token)
**Type:** `String`, `TokenDetails` or `TokenRequest` | -| authCallback | A function which is called when a new token is required. The role of the callback is to obtain a fresh token, one of: an Ably Token string (in plain text format); a signed [`TokenRequest`](/docs/api/realtime-sdk/types#token-request); a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) (in JSON format); an [Ably JWT](/docs/api/realtime-sdk/authentication#ably-jwt). See [our authentication documentation](/docs/auth) for details of the Ably TokenRequest format and associated API calls
**Type:** `Callable` | +| key | The full key string, as obtained from the [application dashboard](https://ably.com/dashboard). Use this option if you wish to use Basic authentication, or wish to be able to issue Ably Tokens without needing to defer to a separate entity to sign Ably TokenRequests. Read more about [Basic authentication](/docs/platform/auth/basic)
**Type:** `String` | +| token | An authenticated [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) object, a [`TokenRequest`](/docs/api/realtime-sdk/types#token-request) object, or token string (obtained from the `token` property of a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) component of an Ably TokenRequest response, or a [JSON Web Token](https://tools.ietf.org/html/rfc7519) satisfying [the Ably requirements for JWTs](/docs/platform/auth/token#jwt)). This option is mostly useful for testing: since tokens are short-lived, in production you almost always want to use an authentication method that allows the client library to renew the token automatically when the previous one expires, such as `authUrl` or `authCallback`. Read more about [Token authentication](/docs/platform/auth/token)
**Type:** `String`, `TokenDetails` or `TokenRequest` | +| authCallback | A function which is called when a new token is required. The role of the callback is to obtain a fresh token, one of: an Ably Token string (in plain text format); a signed [`TokenRequest`](/docs/api/realtime-sdk/types#token-request); a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) (in JSON format); an [Ably JWT](/docs/api/realtime-sdk/authentication#ably-jwt). See [our authentication documentation](/docs/platform/auth) for details of the Ably TokenRequest format and associated API calls
**Type:** `Callable` | | authUrl | A URL that the library may use to obtain a fresh token, one of: an Ably Token string (in plain text format); a signed [`TokenRequest`](/docs/api/realtime-sdk/types#token-request); a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) (in JSON format); an [Ably JWT](/docs/api/realtime-sdk/authentication#ably-jwt). For example, this can be used by a client to obtain signed Ably TokenRequests from an application server
**Type:** `String` | | authMethod | The HTTP verb to use for the request, either `GET` or `POST`
**Type:** `String`
**Default:** `GET` | | authHeaders | A set of key value pair headers to be added to any request made to the `authUrl`. Useful when an application requires these to be added to validate the request or implement the response
**Type:** `Map` | | authParams | A set of key value pair params to be added to any request made to the `authUrl`. When the `authMethod` is `GET`, query params are added to the URL, whereas when `authMethod` is `POST`, the params are sent as URL encoded form data. Useful when an application require these to be added to validate the request or implement the response
**Type:** `Map` | -| tokenDetails | An authenticated [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) object (most commonly obtained from an Ably Token Request response). This option is mostly useful for testing: since tokens are short-lived, in production you almost always want to use an authentication method that allows the client library to renew the token automatically when the previous one expires, such as `authUrl` or `authCallback`. Use this option if you wish to use Token authentication. Read more about [Token authentication](/docs/auth/token)
**Type:** `TokenDetails` | +| tokenDetails | An authenticated [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) object (most commonly obtained from an Ably Token Request response). This option is mostly useful for testing: since tokens are short-lived, in production you almost always want to use an authentication method that allows the client library to renew the token automatically when the previous one expires, such as `authUrl` or `authCallback`. Use this option if you wish to use Token authentication. Read more about [Token authentication](/docs/platform/auth/token)
**Type:** `TokenDetails` | | tls | A boolean value, indicating whether or not a TLS ("SSL") secure connection should be used. An insecure connection cannot be used with Basic authentication as it would lead to a possible compromise of the private API key while in transit. [Find out more about TLS](https://faqs.ably.com/are-messages-sent-to-and-received-from-ably-securely-using-tls)
**Type:** `Boolean`
**Default:** true | -| clientId | A client ID, used for identifying this client when publishing messages or for presence purposes. The `clientId` can be any non-empty string. This option is primarily intended to be used in situations where the library is instantiated with a key; note that a `clientId` may also be implicit in a token used to instantiate the library; an error will be raised if a `clientId` specified here conflicts with the `clientId` implicit in the token. [Find out more about client identities](/docs/auth/identified-clients)
**Type:** `String` | -| useTokenAuth | When true, forces [Token authentication](/docs/auth/token) to be used by the library. Please note that if a `clientId` is not specified in the [`ClientOptions`](/docs/api/realtime-sdk/types#client-options) or [`TokenParams`](/docs/api/realtime-sdk/types#token-params), then the Ably Token issued will be [anonymous](https://faqs.ably.com/authenticated-and-identified-clients)
**Type:** `Boolean`
**Default:** false | +| clientId | A client ID, used for identifying this client when publishing messages or for presence purposes. The `clientId` can be any non-empty string. This option is primarily intended to be used in situations where the library is instantiated with a key; note that a `clientId` may also be implicit in a token used to instantiate the library; an error will be raised if a `clientId` specified here conflicts with the `clientId` implicit in the token. [Find out more about client identities](/docs/platform/auth/identified-clients)
**Type:** `String` | +| useTokenAuth | When true, forces [Token authentication](/docs/platform/auth/token) to be used by the library. Please note that if a `clientId` is not specified in the [`ClientOptions`](/docs/api/realtime-sdk/types#client-options) or [`TokenParams`](/docs/api/realtime-sdk/types#token-params), then the Ably Token issued will be [anonymous](https://faqs.ably.com/authenticated-and-identified-clients)
**Type:** `Boolean`
**Default:** false | | endpoint | Enables [enterprise customers](https://ably.com/pricing) to use their own custom endpoints, which support dedicated, isolated clusters and regional message routing and storage constraints. See our [platform customization guide](/docs/platform/account/enterprise-customization) for more details
**Type:** `String`
**Default:** null | | environment | Deprecated, use `endpoint`. Enables [enterprise customers](https://ably.com/pricing) to use their own custom environments, which support dedicated, isolated clusters and regional message routing and storage constraints. See our [platform customization guide](/docs/platform/account/enterprise-customization) for more details
**Type:** `String`
**Default:** null | | idempotentRestPublishing | When true, enables idempotent publishing by assigning a unique message ID client-side, allowing the Ably servers to discard automatic publish retries following a failure such as a network fault. We recommend you enable this by default. In version 1.2 onwards, idempotent publishing for retries will be enabled by default
**Type:** `Boolean`
**Default:** false | @@ -1073,7 +1073,7 @@ Returns a promise. On success, the promise is fulfilled with a [BatchResult](#ba | queueMessages | If false, this disables the default behavior whereby the library queues messages on a connection in the disconnected or connecting states. The default behavior allows applications to submit messages immediately upon instancing the library without having to wait for the connection to be established. Applications may use this option to disable queueing if they wish to have application-level control over the queueing under those conditions
**Type:** `Boolean`
**Default:** true | | echoMessages | If false, prevents messages originating from this connection being echoed back on the same connection
**Type:** `Boolean`
**Default:** true | | autoConnect | By default as soon as the client library is instantiated it will connect to Ably. You can optionally set this to false and explicitly connect to Ably when require using the [`connect`](/docs/api/realtime-sdk/connection#connect) method
**Type:** `Boolean`
**Default:** true | -| queryTime | If true, the library will query the Ably servers for the current time when [issuing TokenRequests](/docs/auth/token) instead of relying on a locally-available time of day. Knowing the time accurately is needed to create valid signed Ably [TokenRequests](/docs/api/realtime-sdk/authentication#request-token), so this option is useful for library instances on auth servers where for some reason the server clock cannot be kept synchronized through normal means, such as an [NTP daemon](https://en.wikipedia.org/wiki/Ntpd). The server is queried for the current time once per client library instance (which stores the offset from the local clock), so if using this option you should avoid instancing a new version of the library for each request
**Type:** `Boolean`
**Default:** false | +| queryTime | If true, the library will query the Ably servers for the current time when [issuing TokenRequests](/docs/platform/auth/token) instead of relying on a locally-available time of day. Knowing the time accurately is needed to create valid signed Ably [TokenRequests](/docs/api/realtime-sdk/authentication#request-token), so this option is useful for library instances on auth servers where for some reason the server clock cannot be kept synchronized through normal means, such as an [NTP daemon](https://en.wikipedia.org/wiki/Ntpd). The server is queried for the current time once per client library instance (which stores the offset from the local clock), so if using this option you should avoid instancing a new version of the library for each request
**Type:** `Boolean`
**Default:** false | | defaultTokenParams | When a [TokenParams](/docs/api/realtime-sdk/types#token-params) object is provided, it will override the client library defaults when issuing new Ably Tokens or Ably TokenRequests
**Type:** [`TokenParams`](/docs/api/realtime-sdk/types#token-params) | | disconnectedRetryTimeout | When the connection enters the `DISCONNECTED` state, after this delay in milliseconds, if the state is still `DISCONNECTED`, the client library will attempt to reconnect automatically
**Type:** `Integer`
**Default:** 15,000ms | | suspendedRetryTimeout | When the connection enters the `SUSPENDED` state, after this delay in milliseconds, if the state is still `SUSPENDED`, the client library will attempt to reconnect automatically
**Type:** `Integer`
**Default:** 30,000ms | diff --git a/src/pages/docs/api/realtime-sdk/authentication.mdx b/src/pages/docs/api/realtime-sdk/authentication.mdx index 54764aa625..46f200011c 100644 --- a/src/pages/docs/api/realtime-sdk/authentication.mdx +++ b/src/pages/docs/api/realtime-sdk/authentication.mdx @@ -29,7 +29,7 @@ In the documentation, references to Ably-compatible tokens typically refer eithe ## Auth object
-The principal use-case for the `Auth` object is to create Ably [`TokenRequest`](#token-request) objects with [createTokenRequest](#create-token-request) or obtain [Ably Tokens](#token-details) from Ably with [requestToken](#request-token), and then issue them to other "less trusted" clients. Typically, your servers should be the only devices to have a [private API key](/docs/auth#api-key), and this private API key is used to securely sign Ably [`TokenRequest`](#token-request) objects or request [Ably Tokens](#token-details) from Ably. Clients are then issued with these short-lived [Ably Tokens](#token-details) or Ably [`TokenRequest`](#token-request) objects, and the libraries can then use these to authenticate with Ably. If you adopt this model, your private API key is never shared with clients directly. +The principal use-case for the `Auth` object is to create Ably [`TokenRequest`](#token-request) objects with [createTokenRequest](#create-token-request) or obtain [Ably Tokens](#token-details) from Ably with [requestToken](#request-token), and then issue them to other "less trusted" clients. Typically, your servers should be the only devices to have a [private API key](/docs/platform/auth#api-key), and this private API key is used to securely sign Ably [`TokenRequest`](#token-request) objects or request [Ably Tokens](#token-details) from Ably. Clients are then issued with these short-lived [Ably Tokens](#token-details) or Ably [`TokenRequest`](#token-request) objects, and the libraries can then use these to authenticate with Ably. If you adopt this model, your private API key is never shared with clients directly. A subsidiary use-case for the `Auth` object is to preemptively trigger renewal of a token or to acquire a new token with a revised set of capabilities by explicitly calling [`authorize`](#authorize)[`Authorize`](#authorize). @@ -41,7 +41,7 @@ The `ART``Auth` object exposes the following public < ### clientIdclient_idClientId -The client ID string, if any, configured for this client connection. See [identified clients](/docs/auth/identified-clients) for more information on trusted client identifiers. +The client ID string, if any, configured for this client connection. See [identified clients](/docs/platform/auth/identified-clients) for more information on trusted client identifiers. ## Auth Methodsio.ably.lib.rest.Auth MethodsIO.Ably.AblyAuth MethodsAbly::Auth MethodsARTAuth Methods @@ -299,11 +299,11 @@ client.auth.authorize(tokenParams, options: nil) { tokenDetails, error in -Creates and signs an Ably [`TokenRequest`](#request-token) based on the specified (or if none specified, the client library stored) `token_params` and `auth_options``tokenParams` and `authOptions`. Note this can only be used when the [API `key`](/docs/auth#api-key) value is available locally. Otherwise, the Ably [`TokenRequest`](#request-token) must be obtained from the key owner. Use this to generate Ably [`TokenRequests`](#request-token) in order to implement an [Ably Token](#token-details) request callback for use by other clients. +Creates and signs an Ably [`TokenRequest`](#request-token) based on the specified (or if none specified, the client library stored) `token_params` and `auth_options``tokenParams` and `authOptions`. Note this can only be used when the [API `key`](/docs/platform/auth#api-key) value is available locally. Otherwise, the Ably [`TokenRequest`](#request-token) must be obtained from the key owner. Use this to generate Ably [`TokenRequests`](#request-token) in order to implement an [Ably Token](#token-details) request callback for use by other clients. Both `auth_options` and `token_params``authOptions` and `tokenParams` are optional. When omitted or `null`, the default token parameters and authentication options for the client library are used, as specified in the `ClientOptions` when the client library was instantiated, or later updated with an explicit [`authorize`](#authorize)[`Authorize`](#authorize) request. Values passed in will be used instead of (rather than being merged with) the default values. -To understand why an Ably [`TokenRequest`](#request-token) may be issued to clients in favor of a token, see [Token Authentication explained](/docs/auth/token). +To understand why an Ably [`TokenRequest`](#request-token) may be issued to clients in favor of a token, see [Token Authentication explained](/docs/platform/auth/token). #### Parameters @@ -516,7 +516,7 @@ Calls the [`requestToken` REST API endpoint](/docs/api/rest-api#request-token) t Both `auth_options` and `token_params``authOptions` and `tokenParams` are optional. When omitted or `null`, the default token parameters and authentication options for the client library are used, as specified in the `ClientOptions` when the client library was instantiated, or later updated with an explicit [`authorize`](#authorize)[`Authorize`](#authorize) request. Values passed in will be used instead of (rather than being merged with) the default values. -To understand why an Ably [`TokenRequest`](#request-token) may be issued to clients in favor of a token, see [Token Authentication explained](/docs/auth/token). +To understand why an Ably [`TokenRequest`](#request-token) may be issued to clients in favor of a token, see [Token Authentication explained](/docs/platform/auth/token). #### Parameters @@ -710,7 +710,7 @@ client.auth.requestToken(tokenParams, withOptions: : nil) { tokenDetails, error Calls the [`revokeTokens` REST API endpoint](/docs/api/rest-api#revoke-tokens) to revoke tokens specified by the provided array of [TokenRevocationTargetSpecifier](#token-revocation-target-specifier). -Only tokens issued by an API key that had revocable tokens enabled before the token was issued can be revoked. See the [token revocation docs](/docs/auth/revocation) for more information. +Only tokens issued by an API key that had revocable tokens enabled before the token was issued can be revoked. See the [token revocation docs](/docs/platform/auth/revocation) for more information. #### Parameters @@ -767,25 +767,25 @@ try { -`AuthOptions` is a plain JavaScript object and is used when making [authentication](/docs/auth) requests. If passed in, an `authOptions` object will be used instead of (as opposed to supplementing or being merged with) the default values given when the library was instantiated. The following attributes are supported: +`AuthOptions` is a plain JavaScript object and is used when making [authentication](/docs/platform/auth) requests. If passed in, an `authOptions` object will be used instead of (as opposed to supplementing or being merged with) the default values given when the library was instantiated. The following attributes are supported: -`AuthOptions` is a Hash object and is used when making [authentication](/docs/auth) requests. These options will supplement or override the corresponding options given when the library was instantiated. The following key symbol values can be added to the Hash: +`AuthOptions` is a Hash object and is used when making [authentication](/docs/platform/auth) requests. These options will supplement or override the corresponding options given when the library was instantiated. The following key symbol values can be added to the Hash: -`ARTAuthOptions` is used when making [authentication](/docs/auth) requests. These options will supplement or override the corresponding options given when the library was instantiated. +`ARTAuthOptions` is used when making [authentication](/docs/platform/auth) requests. These options will supplement or override the corresponding options given when the library was instantiated. -`AuthOptions` is used when making [authentication](/docs/auth) requests. These options will supplement or override the corresponding options given when the library was instantiated. +`AuthOptions` is used when making [authentication](/docs/platform/auth) requests. These options will supplement or override the corresponding options given when the library was instantiated. @@ -793,15 +793,15 @@ try { | Property | Description | Type | |----------|-------------|------| -| authCallbackAuthCallback:auth_callback | A functionfunction with the form `function(tokenParams, callback(err, tokenOrTokenRequest))``TokenCallback` instanceproc / lambda (called synchronously in REST and Realtime but does not block EventMachine in the latter) which is called when a new token is required. The role of the callback is to obtain a fresh token, one of: an Ably Token string (in plain text format); a signed [`TokenRequest`](/docs/api/realtime-sdk/types#token-request) ; a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) (in JSON format); an [Ably JWT](/docs/api/realtime-sdk/authentication#ably-jwt). See [our authentication documentation](/docs/auth) for details of the Ably TokenRequest format and associated API calls. | `Callable``TokenCallback``Proc``Func>` | +| authCallbackAuthCallback:auth_callback | A functionfunction with the form `function(tokenParams, callback(err, tokenOrTokenRequest))``TokenCallback` instanceproc / lambda (called synchronously in REST and Realtime but does not block EventMachine in the latter) which is called when a new token is required. The role of the callback is to obtain a fresh token, one of: an Ably Token string (in plain text format); a signed [`TokenRequest`](/docs/api/realtime-sdk/types#token-request) ; a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) (in JSON format); an [Ably JWT](/docs/api/realtime-sdk/authentication#ably-jwt). See [our authentication documentation](/docs/platform/auth) for details of the Ably TokenRequest format and associated API calls. | `Callable``TokenCallback``Proc``Func>` | | authUrlAuthUrl:auth_url | A URL that the library may use to obtain a fresh token, one of: an Ably Token string (in plain text format); a signed [`TokenRequest`](/docs/api/realtime-sdk/types#token-request) ; a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) (in JSON format); an [Ably JWT](/docs/api/realtime-sdk/authentication#ably-jwt). For example, this can be used by a client to obtain signed Ably TokenRequests from an application server. | `String``Uri``NSURL` | | authMethodAuthMethod:auth_method | _`GET``:get`_ The HTTP verb to use for the request, either `GET``:get` or `POST``:post` | `String``Symbol``HttpMethod` | | authHeadersAuthHeaders:auth_headers | A set of key value pair headers to be added to any request made to the `authUrl``AuthUrl`. Useful when an application requires these to be added to validate the request or implement the response. If the `authHeaders` object contains an `authorization` key, then `withCredentials` will be set on the xhr request. | `Object``Hash``Param []``Dictionary` | | authParamsAuthParams:auth_params | A set of key value pair params to be added to any request made to the `authUrl``AuthUrl`. When the `authMethod``AuthMethod` is `GET`, query params are added to the URL, whereas when `authMethod``AuthMethod` is `POST`, the params are sent as URL encoded form data. Useful when an application require these to be added to validate the request or implement the response. | `Object``Hash``Param[]``Dictionary``NSArray``[NSURLQueryItem]/Array` | -| tokenDetailsTokenDetails:token_details | An authenticated [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) object (most commonly obtained from an Ably Token Request response). This option is mostly useful for testing: since tokens are short-lived, in production you almost always want to use an authentication method that allows the client library to renew the token automatically when the previous one expires, such as `authUrl``AuthUrl``:auth_url` or `authCallback`AuthCallback`auth_callback``:auth_callback`. Use this option if you wish to use Token authentication. Read more about [Token authentication](/docs/auth/token) | `TokenDetails` | -| keyKey:key | Optionally the [API key](/docs/auth#api-key) to use can be specified as a full key string; if not, the API key passed into [`ClientOptions`](#client-options) when instancing the Realtime or REST library is used | `String` | -| queryTimeQueryTime:query_time | _false_ If true, the library will query the Ably servers for the current time when [issuing TokenRequests](/docs/auth/token) instead of relying on a locally-available time of day. Knowing the time accurately is needed to create valid signed Ably [TokenRequests](/docs/auth/token), so this option is useful for library instances on auth servers where for some reason the server clock cannot be kept synchronized through normal means, such as an [NTP daemon](https://en.wikipedia.org/wiki/Ntpd) . The server is queried for the current time once per client library instance (which stores the offset from the local clock), so if using this option you should avoid instancing a new version of the library for each request. | `Boolean` | -| tokenToken:token | An authenticated token. This can either be a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) object, a [`TokenRequest`](/docs/api/realtime-sdk/types#token-request) object, or token string (obtained from the `token``Token` property of a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) component of an Ably TokenRequest response, or a [JSON Web Token](https://tools.ietf.org/html/rfc7519) satisfying [the Ably requirements for JWTs](/docs/auth/token#jwt)). This option is mostly useful for testing: since tokens are short-lived, in production you almost always want to use an authentication method that allows the client library to renew the token automatically when the previous one expires, such as `authUrl`AuthUrl:auth_urlauth_url or authCallbackAuthCallbackauth_callback:auth_callback. Read more about [Token authentication](/docs/auth/token) | `String`, `TokenDetails` or `TokenRequest` | +| tokenDetailsTokenDetails:token_details | An authenticated [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) object (most commonly obtained from an Ably Token Request response). This option is mostly useful for testing: since tokens are short-lived, in production you almost always want to use an authentication method that allows the client library to renew the token automatically when the previous one expires, such as `authUrl``AuthUrl``:auth_url` or `authCallback`AuthCallback`auth_callback``:auth_callback`. Use this option if you wish to use Token authentication. Read more about [Token authentication](/docs/platform/auth/token) | `TokenDetails` | +| keyKey:key | Optionally the [API key](/docs/platform/auth#api-key) to use can be specified as a full key string; if not, the API key passed into [`ClientOptions`](#client-options) when instancing the Realtime or REST library is used | `String` | +| queryTimeQueryTime:query_time | _false_ If true, the library will query the Ably servers for the current time when [issuing TokenRequests](/docs/platform/auth/token) instead of relying on a locally-available time of day. Knowing the time accurately is needed to create valid signed Ably [TokenRequests](/docs/platform/auth/token), so this option is useful for library instances on auth servers where for some reason the server clock cannot be kept synchronized through normal means, such as an [NTP daemon](https://en.wikipedia.org/wiki/Ntpd) . The server is queried for the current time once per client library instance (which stores the offset from the local clock), so if using this option you should avoid instancing a new version of the library for each request. | `Boolean` | +| tokenToken:token | An authenticated token. This can either be a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) object, a [`TokenRequest`](/docs/api/realtime-sdk/types#token-request) object, or token string (obtained from the `token``Token` property of a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) component of an Ably TokenRequest response, or a [JSON Web Token](https://tools.ietf.org/html/rfc7519) satisfying [the Ably requirements for JWTs](/docs/platform/auth/token#jwt)). This option is mostly useful for testing: since tokens are short-lived, in production you almost always want to use an authentication method that allows the client library to renew the token automatically when the previous one expires, such as `authUrl`AuthUrl:auth_urlauth_url or authCallbackAuthCallbackauth_callback:auth_callback. Read more about [Token authentication](/docs/platform/auth/token) | `String`, `TokenDetails` or `TokenRequest` | ### TokenDetails ObjectARTTokenDetailsio.ably.lib.types.TokenDetailsAbly::Models::TokenDetailsIO.Ably.TokenDetails @@ -814,8 +814,8 @@ try { | tokenToken | The [Ably Token](/docs/api/realtime-sdk/authentication#token-details) itself. A typical [Ably Token](/docs/api/realtime-sdk/authentication#token-details) string may appear like `{{TOKEN}}` | `String` | | expiresExpires | The time (in milliseconds since the epoch)The time at which this token expires | `Integer``Long Integer``DateTimeOffset``Time``NSDate` | | issuedIssued | The time (in milliseconds since the epoch)The time at which this token was issued | `Integer``Long Integer``DateTimeOffset``Time``NSDate` | -| capabilityCapability | The capability associated with this [Ably Token](/docs/api/realtime-sdk/authentication#token-details). The capability is a a JSON stringified canonicalized representation of the resource paths and associated operations. [Read more about authentication and capabilities](/docs/auth/capabilities) | `String``Capability` | -| clientIdclient_idClientId | The client ID, if any, bound to this [Ably Token](/docs/api/realtime-sdk/authentication#token-details). If a client ID is included, then the [Ably Token](/docs/api/realtime-sdk/authentication#token-details) authenticates its bearer as that client ID, and the [Ably Token](/docs/api/realtime-sdk/authentication#token-details) may only be used to perform operations on behalf of that client ID. The client is then considered to be an [identified client](/docs/auth/identified-clients) | `String` | +| capabilityCapability | The capability associated with this [Ably Token](/docs/api/realtime-sdk/authentication#token-details). The capability is a a JSON stringified canonicalized representation of the resource paths and associated operations. [Read more about authentication and capabilities](/docs/platform/auth/capabilities) | `String``Capability` | +| clientIdclient_idClientId | The client ID, if any, bound to this [Ably Token](/docs/api/realtime-sdk/authentication#token-details). If a client ID is included, then the [Ably Token](/docs/api/realtime-sdk/authentication#token-details) authenticates its bearer as that client ID, and the [Ably Token](/docs/api/realtime-sdk/authentication#token-details) may only be used to perform operations on behalf of that client ID. The client is then considered to be an [identified client](/docs/platform/auth/identified-clients) | `String` | @@ -868,25 +868,25 @@ A [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) object -`TokenParams` is a plain JavaScript object and is used in the parameters of [token authentication](/docs/auth/token) requests, corresponding to the desired attributes of the [Ably Token](/docs/api/realtime-sdk/authentication#token-details). The following attributes can be defined on the object: +`TokenParams` is a plain JavaScript object and is used in the parameters of [token authentication](/docs/platform/auth/token) requests, corresponding to the desired attributes of the [Ably Token](/docs/api/realtime-sdk/authentication#token-details). The following attributes can be defined on the object: -`TokenParams` is a Hash object and is used in the parameters of [token authentication](/docs/auth/token) requests, corresponding to the desired attributes of the [Ably Token](/docs/api/realtime-sdk/authentication#token-details). The following key symbol values can be added to the Hash: +`TokenParams` is a Hash object and is used in the parameters of [token authentication](/docs/platform/auth/token) requests, corresponding to the desired attributes of the [Ably Token](/docs/api/realtime-sdk/authentication#token-details). The following key symbol values can be added to the Hash: -`TokenParams` is used in the parameters of [token authentication](/docs/auth/token) requests, corresponding to the desired attributes of the [Ably Token](/docs/api/realtime-sdk/authentication#token-details). +`TokenParams` is used in the parameters of [token authentication](/docs/platform/auth/token) requests, corresponding to the desired attributes of the [Ably Token](/docs/api/realtime-sdk/authentication#token-details). -`ARTTokenParams` is used in the parameters of [token authentication](/docs/auth/token) requests, corresponding to the desired attributes of the [Ably Token](/docs/api/realtime-sdk/authentication#token-details). +`ARTTokenParams` is used in the parameters of [token authentication](/docs/platform/auth/token) requests, corresponding to the desired attributes of the [Ably Token](/docs/api/realtime-sdk/authentication#token-details). @@ -894,8 +894,8 @@ A [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) object | Property | Description | Type | |----------|-------------|------| -| capabilityCapability:capability | JSON stringified capability of the [Ably Token](/docs/api/realtime-sdk/authentication#token-details). If the [Ably Token](/docs/api/realtime-sdk/authentication#token-details) request is successful, the capability of the returned [Ably Token](/docs/api/realtime-sdk/authentication#token-details) will be the intersection of this capability with the capability of the issuing key. [Find our more about how to use capabilities to manage access privileges for clients](/docs/auth/capabilities). | `String``Capability` | -| clientIdClientIdclient_id:client_id | A client ID, used for identifying this client when publishing messages or for presence purposes. The `clientId``client_id``ClientId` can be any non-empty string. This option is primarily intended to be used in situations where the library is instantiated with a key; note that a `clientId``client_id``ClientId` may also be implicit in a token used to instantiate the library; an error will be raised if a `clientId``client_id``ClientId` specified here conflicts with the `clientId``client_id``ClientId` implicit in the token. [Find out more about client identities](/docs/auth/identified-clients) | `String` | +| capabilityCapability:capability | JSON stringified capability of the [Ably Token](/docs/api/realtime-sdk/authentication#token-details). If the [Ably Token](/docs/api/realtime-sdk/authentication#token-details) request is successful, the capability of the returned [Ably Token](/docs/api/realtime-sdk/authentication#token-details) will be the intersection of this capability with the capability of the issuing key. [Find our more about how to use capabilities to manage access privileges for clients](/docs/platform/auth/capabilities). | `String``Capability` | +| clientIdClientIdclient_id:client_id | A client ID, used for identifying this client when publishing messages or for presence purposes. The `clientId``client_id``ClientId` can be any non-empty string. This option is primarily intended to be used in situations where the library is instantiated with a key; note that a `clientId``client_id``ClientId` may also be implicit in a token used to instantiate the library; an error will be raised if a `clientId``client_id``ClientId` specified here conflicts with the `clientId``client_id``ClientId` implicit in the token. [Find out more about client identities](/docs/platform/auth/identified-clients) | `String` | | nonceNonce:nonce | An optional opaque nonce string of at least 16 characters to ensure uniqueness of this request. Any subsequent request using the same nonce will be rejected. | `String` | | timestampTimestamp:timestamp | The timestamp (in milliseconds since the epoch)The timestamp of this request. `timestamp`, in conjunction with the `nonce`, is used to prevent requests for [Ably Token](/docs/api/realtime-sdk/authentication#token-details) from being replayed. | `Integer``Long Integer``Time``NSDate``DateTimeOffset``DateTime` | | ttlTtl:ttl | Requested time to live for the [Ably Token](/docs/api/realtime-sdk/authentication#token-details) being created in millisecondsin secondsas a `NSTimeInterval`as a `TimeSpan`. When omitted, the Ably REST API default of 60 minutes is applied by Ably.
_Default: 1 hour_ | `Integer` (milliseconds)`Integer` (seconds)`NSTimeInterval``Long Integer``TimeSpan` | @@ -911,7 +911,7 @@ A [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) object | keyNamekey_nameKeyName | The key name of the key against which this request is made. The key name is public, whereas the key secret is private | `String` | | ttlTtl | Requested time to live for the [Ably Token](/docs/api/realtime-sdk/authentication#token-details) in millisecondsin secondsas a `TimeSpan`. If the Ably `TokenRequest` is successful, the TTL of the returned [Ably Token](/docs/api/realtime-sdk/authentication#token-details) will be less than or equal to this value depending on application settings and the attributes of the issuing key. | `Integer``TimeSpan``NSTimeInterval` | | timestampTimestamp | The timestamp of this request in milliseconds | `Integer``Long Integer``Time``DateTimeOffset``NSDate` | -| capabilityCapability | Capability of the requested [Ably Token](/docs/api/realtime-sdk/authentication#token-details). If the Ably `TokenRequest` is successful, the capability of the returned [Ably Token](/docs/api/realtime-sdk/authentication#token-details) will be the intersection of this capability with the capability of the issuing key. The capability is a JSON stringified canonicalized representation of the resource paths and associated operations. [Read more about authentication and capabilities](/docs/auth) | `String` | +| capabilityCapability | Capability of the requested [Ably Token](/docs/api/realtime-sdk/authentication#token-details). If the Ably `TokenRequest` is successful, the capability of the returned [Ably Token](/docs/api/realtime-sdk/authentication#token-details) will be the intersection of this capability with the capability of the issuing key. The capability is a JSON stringified canonicalized representation of the resource paths and associated operations. [Read more about authentication and capabilities](/docs/platform/auth) | `String` | | clientIdclient_idClientId | The client ID to associate with the requested [Ably Token](/docs/api/realtime-sdk/authentication#token-details). When provided, the [Ably Token](/docs/api/realtime-sdk/authentication#token-details) may only be used to perform operations on behalf of that client ID | `String` | | nonceNonce | An opaque nonce string of at least 16 characters | `String` | | macMac | The Message Authentication Code for this request | `String` | @@ -958,7 +958,7 @@ An Ably JWT is not strictly an Ably construct, rather it is a [JWT](https://jwt. Arbitrary additional claims and headers are supported (apart from those prefixed with `x-ably-` which are reserved for future use). -The Ably JWT must be signed with the secret part of your [Ably API key](/docs/auth#api-key) using the signature algorithm HS256 (HMAC using the SHA-256 hash algorithm). View the [JSON Web Algorithms (JWA) specification](https://tools.ietf.org/html/rfc7518) for further information. +The Ably JWT must be signed with the secret part of your [Ably API key](/docs/platform/auth#api-key) using the signature algorithm HS256 (HMAC using the SHA-256 hash algorithm). View the [JSON Web Algorithms (JWA) specification](https://tools.ietf.org/html/rfc7518) for further information. We recommend you use one of the many [JWT libraries available for simplicity](https://jwt.io/) when creating your JWTs. diff --git a/src/pages/docs/api/realtime-sdk/channels.mdx b/src/pages/docs/api/realtime-sdk/channels.mdx index d0e98f56d4..5e0cd9ffd9 100644 --- a/src/pages/docs/api/realtime-sdk/channels.mdx +++ b/src/pages/docs/api/realtime-sdk/channels.mdx @@ -830,7 +830,7 @@ Failure to retrieve the message history will trigger the `errback` callbacks of `getMessage(serialOrMessage: string | Message): Promise` -Retrieves the latest version of a specific message by its serial identifier. Requires the **history** [capability](/docs/auth/capabilities). +Retrieves the latest version of a specific message by its serial identifier. Requires the **history** [capability](/docs/platform/auth/capabilities). See [updating and deleting messages: retrieving the latest version](/docs/messages/updates-deletes#get) for more information. @@ -905,7 +905,7 @@ Returns a promise which, upon success, will be fulfilled with an [`UpdateDeleteR `getMessageVersions(serialOrMessage: string | Message, params?: Record): Promise>` -Retrieves all historical versions of a specific message, ordered by version. This includes the original message and all subsequent updates or delete operations. Requires the **history** [capability](/docs/auth/capabilities). +Retrieves all historical versions of a specific message, ordered by version. This includes the original message and all subsequent updates or delete operations. Requires the **history** [capability](/docs/platform/auth/capabilities). See [updating and deleting messages: message versions](/docs/messages/updates-deletes#versions) for more information. diff --git a/src/pages/docs/api/realtime-sdk/presence.mdx b/src/pages/docs/api/realtime-sdk/presence.mdx index 5e04e9ac8f..11d5b37d8e 100644 --- a/src/pages/docs/api/realtime-sdk/presence.mdx +++ b/src/pages/docs/api/realtime-sdk/presence.mdx @@ -870,7 +870,7 @@ Unsubscribes all listeners to presence message events on this channel. This remo ### enterCliententer_clientEnterClientAsync
-Enter this presence channel for the given `clientId``client_id``ClientId`. This method is provided to support typically server instances that act on behalf of multiple client IDs. See [Managing multiple client IDs](/docs/presence-occupancy/presence#presence-multiple-client-id) for more info. In order to be able to publish presence changes for arbitrary client IDs, the client library must have been instantiated either with an [API key](/docs/auth#api-keys,) or with a [token bound to a wildcard client ID](https://faqs.ably.com/can-a-client-emulate-any-client-id-i.e.-authenticate-using-a-wildcard-client-id.) +Enter this presence channel for the given `clientId``client_id``ClientId`. This method is provided to support typically server instances that act on behalf of multiple client IDs. See [Managing multiple client IDs](/docs/presence-occupancy/presence#presence-multiple-client-id) for more info. In order to be able to publish presence changes for arbitrary client IDs, the client library must have been instantiated either with an [API key](/docs/platform/auth#api-keys,) or with a [token bound to a wildcard client ID](https://faqs.ably.com/can-a-client-emulate-any-client-id-i.e.-authenticate-using-a-wildcard-client-id.) diff --git a/src/pages/docs/api/realtime-sdk/push-admin.mdx b/src/pages/docs/api/realtime-sdk/push-admin.mdx index 53b8b171dd..917d36d660 100644 --- a/src/pages/docs/api/realtime-sdk/push-admin.mdx +++ b/src/pages/docs/api/realtime-sdk/push-admin.mdx @@ -27,7 +27,7 @@ The returned [`DeviceRegistrations`](#device-registrations-object) object provid #### channelSubscriptionschannel_subscriptions -The returned [`PushChannelSubscriptions`](#push-channel-subscriptions) object provides functionality for subscribing, listing and unsubscribing individual devices or groups of [identified devices](/docs/auth/identified-clients) to push notifications published on channels. +The returned [`PushChannelSubscriptions`](#push-channel-subscriptions) object provides functionality for subscribing, listing and unsubscribing individual devices or groups of [identified devices](/docs/platform/auth/identified-clients) to push notifications published on channels. ### Methods @@ -59,7 +59,7 @@ The returned [`PushChannelSubscriptions`](#push-channel-subscriptions) object pr -Publishes a push notification directly to a device or group of devices sharing a [client identifier](/docs/auth/identified-clients). See the [push notification direct publishing documentation](/docs/push/publish#direct-publishing) for more information. +Publishes a push notification directly to a device or group of devices sharing a [client identifier](/docs/platform/auth/identified-clients). See the [push notification direct publishing documentation](/docs/push/publish#direct-publishing) for more information. ##### Parameters @@ -623,7 +623,7 @@ This object is accessible through clientIdclient_id | Optional trusted [client identifier](/docs/auth/identified-clients) for the device | `String` | +| clientIdclient_id | Optional trusted [client identifier](/docs/platform/auth/identified-clients) for the device | `String` | | formFactorform_factor | Form factor of the push device. Must be one of `phone`, `tablet`, `desktop`, `tv`, `watch`, `car` or `embedded``embedded` or `other` | `String` | | metadata | Optional metadata object for this device. The metadata for a device may only be set by clients with `push-admin` privileges | `Object``Hash` | | platform | Platform of the push device. Must be one of `ios` or `android``android` or `browser` | `String` | @@ -1140,7 +1140,7 @@ Failure to retrieve the message history will raise an [`AblyException`](/docs/ap ### PushChannelSubscriptionARTPushChannelSubscriptionChannelSubscriptionArt::Models::PushChannelSubscription -An `PushChannelSubscription` is a type encapsulating the subscription of a device or group of devices sharing a [client identifier](/docs/auth/identified-clients) to a channel in order to receive push notifications. +An `PushChannelSubscription` is a type encapsulating the subscription of a device or group of devices sharing a [client identifier](/docs/platform/auth/identified-clients) to a channel in order to receive push notifications. #### PropertiesMembersAttributes @@ -1148,7 +1148,7 @@ An `PushChannelSubscription` is a type encapsulating the subscription of a devic |----------|------|-------------| | channel | The channel that this push notification subscription is associated with | `String` | | deviceIddevice_id | The device with this identifier is linked to this channel subscription. When present, `clientId``client_id` is never present | `String` | -| clientIdclient_id | Devices with this [client identifier](/docs/auth/identified-clients) are included in this channel subscription. When present, `deviceId``device_id` is never present | `String` | +| clientIdclient_id | Devices with this [client identifier](/docs/platform/auth/identified-clients) are included in this channel subscription. When present, `deviceId``device_id` is never present | `String` | @@ -1193,14 +1193,14 @@ A [`PushChannelSubscription`](/docs/api/realtime-sdk/types#push-channel-subscrip -A static factory method to create a `PushChannelSubscription` object for a channel and group of devices sharing a [client identifier](/docs/auth/identified-clients). +A static factory method to create a `PushChannelSubscription` object for a channel and group of devices sharing a [client identifier](/docs/platform/auth/identified-clients). ##### Parameters | Parameter | Description | Type | |-----------|------|-------------| | channel | Channel name linked to this push channel subscription | `String` | -| clientIdclient_id | Devices with this [client identifier](/docs/auth/identified-clients) are included in the new push channel subscription | `String` | +| clientIdclient_id | Devices with this [client identifier](/docs/platform/auth/identified-clients) are included in the new push channel subscription | `String` | ##### Returns diff --git a/src/pages/docs/api/realtime-sdk/push.mdx b/src/pages/docs/api/realtime-sdk/push.mdx index 89196da0e7..8fbe075d93 100644 --- a/src/pages/docs/api/realtime-sdk/push.mdx +++ b/src/pages/docs/api/realtime-sdk/push.mdx @@ -124,7 +124,7 @@ A `DeviceDetails` is a type encapsulating attributes of a device registered for | Property | Description | Type | |----------|-------------|------| | id | Unique identifier for the device generated by the device itself | `String` | -| clientId | Optional trusted [client identifier](/docs/auth/identified-clients) for the device | `String` | +| clientId | Optional trusted [client identifier](/docs/platform/auth/identified-clients) for the device | `String` | | formFactor | Form factor of the push device. Must be one of `phone`, `tablet`, `desktop`, `tv`, `watch`, `car` or `embedded``embedded` or `other` | `String` | | metadata | Optional metadata object for this device. The metadata for a device may only be set by clients with `push-admin` privileges | `Object` | | platform | Platform of the push device. Must be one of `ios` or `android``android` or `browser` | `String` | @@ -361,7 +361,7 @@ Failure to retrieve the message history will raise an [`AblyException`](/docs/ap ### PushChannelSubscriptionChannelSubscriptionARTPushChannelSubscription -A `PushChannelSubscription` is a type encapsulating the subscription of a device or group of devices sharing a [client identifier](/docs/auth/identified-clients) to a channel in order to receive push notifications. +A `PushChannelSubscription` is a type encapsulating the subscription of a device or group of devices sharing a [client identifier](/docs/platform/auth/identified-clients) to a channel in order to receive push notifications. #### PropertiesMembers @@ -369,7 +369,7 @@ A `PushChannelSubscription` is a type encapsulating the subscription of a device |----------|-------------|------| | channel | The channel that this push notification subscription is associated with | `String` | | deviceId | The device with this identifier is linked to this channel subscription. When present, `clientId` is never present | `String` | -| clientId | Devices with this [client identifier](/docs/auth/identified-clients) are included in this channel subscription. When present, `deviceId` is never present | `String` | +| clientId | Devices with this [client identifier](/docs/platform/auth/identified-clients) are included in this channel subscription. When present, `deviceId` is never present | `String` | @@ -396,14 +396,14 @@ A [`PushChannelSubscription`](/docs/api/realtime-sdk/types#push-channel-subscrip `PushChannelSubscription.forClient(String channel, String clientId) -> PushChannelSubscription` -A static factory method to create a `PushChannelSubscription` object for a channel and group of devices sharing a [client identifier](/docs/auth/identified-clients). +A static factory method to create a `PushChannelSubscription` object for a channel and group of devices sharing a [client identifier](/docs/platform/auth/identified-clients). ##### Parameters | Parameter | Description | Type | |-----------|-------------|------| | channel | Channel name linked to this push channel subscription | `String` | -| clientId | Devices with this [client identifier](/docs/auth/identified-clients) are included in the new push channel subscription | `String` | +| clientId | Devices with this [client identifier](/docs/platform/auth/identified-clients) are included in the new push channel subscription | `String` | ##### Returns diff --git a/src/pages/docs/api/realtime-sdk/types.mdx b/src/pages/docs/api/realtime-sdk/types.mdx index 64452764e7..98a999da59 100644 --- a/src/pages/docs/api/realtime-sdk/types.mdx +++ b/src/pages/docs/api/realtime-sdk/types.mdx @@ -142,7 +142,7 @@ A `DeviceDetails` is a type encapsulating attributes of a device registered for | Property | Description | Type | |----------|-------------|------| | id | unique identifier for the device generated by the device itself | `String` | -| clientIdclient_id | optional trusted [client identifier](/docs/auth/identified-clients) for the device | `String` | +| clientIdclient_id | optional trusted [client identifier](/docs/platform/auth/identified-clients) for the device | `String` | | formFactorform_factor | form factor of the push device. Must be one of `phone`, `tablet`, `desktop`, `tv`, `watch`, `car`, or `embedded` | `String` | | metadata | optional metadata object for this device. The metadata for a device may only be set by clients with `push-admin` privileges | `Object` | | platform | platform of the push device. Must be one of `ios` or `android` | `String` | @@ -1335,7 +1335,7 @@ Please note that `key` and `value` attributes are always strings. If an `Integer ### PushChannelSubscriptionAbly::Models::PushChannelSubscription -An `PushChannelSubscription` is a type encapsulating the subscription of a device or group of devices sharing a [client identifier](/docs/auth/identified-clients) to a channel in order to receive push notifications. +An `PushChannelSubscription` is a type encapsulating the subscription of a device or group of devices sharing a [client identifier](/docs/platform/auth/identified-clients) to a channel in order to receive push notifications. #### Properties @@ -1343,7 +1343,7 @@ An `PushChannelSubscription` is a type encapsulating the subscription of a devic |----------|-------------|------| | channel | The channel that this push notification subscription is associated with | `String` | | deviceIddevice_id | The device with this identifier is linked to this channel subscription. When present, `clientId``client_id` is never present | `String` | -| clientIdclient_id | Devices with this [client identifier](/docs/auth/identified-clients) are included in this channel subscription. When present, `deviceId``device_id` is never present | `String` | +| clientIdclient_id | Devices with this [client identifier](/docs/platform/auth/identified-clients) are included in this channel subscription. When present, `deviceId``device_id` is never present | `String` | @@ -1390,14 +1390,14 @@ A [`PushChannelSubscription`](/docs/api/realtime-sdk/types#push-channel-subscrip -A static factory method to create a `PushChannelSubscription` object for a channel and group of devices sharing a [client identifier](/docs/auth/identified-clients). +A static factory method to create a `PushChannelSubscription` object for a channel and group of devices sharing a [client identifier](/docs/platform/auth/identified-clients). ##### Parameters | Parameter | Description | Type | |-----------|-------------|------| | channel | Channel name linked to this push channel subscription | `String` | -| clientIdclient_id | Devices with this [client identifier](/docs/auth/identified-clients) are included in the new push channel subscription | `String` | +| clientIdclient_id | Devices with this [client identifier](/docs/platform/auth/identified-clients) are included in the new push channel subscription | `String` | ##### Returns @@ -1416,8 +1416,8 @@ A `PushChannelSubscription` object | tokenToken | The [Ably Token](/docs/api/realtime-sdk/authentication#token-details) itself. A typical [Ably Token](/docs/api/realtime-sdk/authentication#token-details) string may appear like `{{TOKEN}}` | `String` | | expiresExpires | The time (in milliseconds since the epoch)The time at which this token expires | `Integer``Long Integer``DateTimeOffset``Time``NSDate` | | issuedIssued | The time (in milliseconds since the epoch)The time at which this token was issued | `Integer``Long Integer``DateTimeOffset``Time``NSDate` | -| capabilityCapability | The capability associated with this [Ably Token](/docs/api/realtime-sdk/authentication#token-details). The capability is a a JSON stringified canonicalized representation of the resource paths and associated operations. [Read more about authentication and capabilities](/docs/auth/capabilities) | `String``Capability` | -| clientIdclient_idClientId | The client ID, if any, bound to this [Ably Token](/docs/api/realtime-sdk/authentication#token-details). If a client ID is included, then the [Ably Token](/docs/api/realtime-sdk/authentication#token-details) authenticates its bearer as that client ID, and the [Ably Token](/docs/api/realtime-sdk/authentication#token-details) may only be used to perform operations on behalf of that client ID. The client is then considered to be an [identified client](/docs/auth/identified-clients) | `String` | +| capabilityCapability | The capability associated with this [Ably Token](/docs/api/realtime-sdk/authentication#token-details). The capability is a a JSON stringified canonicalized representation of the resource paths and associated operations. [Read more about authentication and capabilities](/docs/platform/auth/capabilities) | `String``Capability` | +| clientIdclient_idClientId | The client ID, if any, bound to this [Ably Token](/docs/api/realtime-sdk/authentication#token-details). If a client ID is included, then the [Ably Token](/docs/api/realtime-sdk/authentication#token-details) authenticates its bearer as that client ID, and the [Ably Token](/docs/api/realtime-sdk/authentication#token-details) may only be used to perform operations on behalf of that client ID. The client is then considered to be an [identified client](/docs/platform/auth/identified-clients) | `String` | @@ -1506,7 +1506,7 @@ A [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) object | keyNamekey_nameKeyName | The key name of the key against which this request is made. The key name is public, whereas the key secret is private | `String` | | ttlTtl | Requested time to live for the [Ably Token](/docs/api/realtime-sdk/authentication#token-details) in millisecondsin secondsas a `TimeSpan`. If the Ably `TokenRequest` is successful, the TTL of the returned [Ably Token](/docs/api/realtime-sdk/authentication#token-details) will be less than or equal to this value depending on application settings and the attributes of the issuing key. | `Integer``TimeSpan``NSTimeInterval` | | timestampTimestamp | The timestamp of this request in milliseconds | `Integer``Long Integer``Time``DateTimeOffset``Integer` | -| capabilityCapability | Capability of the requested [Ably Token](/docs/api/realtime-sdk/authentication#token-details). If the Ably `TokenRequest` is successful, the capability of the returned [Ably Token](/docs/api/realtime-sdk/authentication#token-details) will be the intersection of this capability with the capability of the issuing key. The capability is a JSON stringified canonicalized representation of the resource paths and associated operations. [Read more about authentication and capabilities](/docs/auth) | `String` | +| capabilityCapability | Capability of the requested [Ably Token](/docs/api/realtime-sdk/authentication#token-details). If the Ably `TokenRequest` is successful, the capability of the returned [Ably Token](/docs/api/realtime-sdk/authentication#token-details) will be the intersection of this capability with the capability of the issuing key. The capability is a JSON stringified canonicalized representation of the resource paths and associated operations. [Read more about authentication and capabilities](/docs/platform/auth) | `String` | | clientIdclient_idClientId | The client ID to associate with the requested [Ably Token](/docs/api/realtime-sdk/authentication#token-details). When provided, the [Ably Token](/docs/api/realtime-sdk/authentication#token-details) may only be used to perform operations on behalf of that client ID | `String` | | nonceNonce | An opaque nonce string of at least 16 characters | `String` | | macMac | The Message Authentication Code for this request | `String` | @@ -1836,19 +1836,19 @@ A `TokenRevocationFailureResult` contains information about the result of an uns -`AuthOptions` is a plain JavaScript object and is used when making [authentication](/docs/auth) requests. If passed in, an `authOptions` object will be used instead of (as opposed to supplementing or being merged with) the default values given when the library was instantiated. The following attributes are supported: +`AuthOptions` is a plain JavaScript object and is used when making [authentication](/docs/platform/auth) requests. If passed in, an `authOptions` object will be used instead of (as opposed to supplementing or being merged with) the default values given when the library was instantiated. The following attributes are supported: -`AuthOptions` is a Hash object and is used when making [authentication](/docs/auth) requests. These options will supplement or override the corresponding options given when the library was instantiated. The following key symbol values can be added to the Hash: +`AuthOptions` is a Hash object and is used when making [authentication](/docs/platform/auth) requests. These options will supplement or override the corresponding options given when the library was instantiated. The following key symbol values can be added to the Hash: -`ART``AuthOptions` is used when making [authentication](/docs/auth) requests. These options will supplement or override the corresponding options given when the library was instantiated. +`ART``AuthOptions` is used when making [authentication](/docs/platform/auth) requests. These options will supplement or override the corresponding options given when the library was instantiated. @@ -1870,15 +1870,15 @@ A `TokenRevocationFailureResult` contains information about the result of an uns | Property | Description | Type | |----------|-------------|------| -| authCallbackAuthCallback:auth_callback | A functionfunction with the form `function(tokenParams, callback(err, tokenOrTokenRequest))``TokenCallback` instanceproc / lambda (called synchronously in REST and Realtime but does not block EventMachine in the latter) which is called when a new token is required. The role of the callback is to obtain a fresh token, one of: an Ably Token string (in plain text format); a signed [`TokenRequest`](/docs/api/realtime-sdk/types#token-request); a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) (in JSON format); an [Ably JWT](/docs/api/realtime-sdk/authentication#ably-jwt). See [our authentication documentation](/docs/auth) for details of the Ably TokenRequest format and associated API calls. | `Callable``TokenCallback``Proc``Func>` | +| authCallbackAuthCallback:auth_callback | A functionfunction with the form `function(tokenParams, callback(err, tokenOrTokenRequest))``TokenCallback` instanceproc / lambda (called synchronously in REST and Realtime but does not block EventMachine in the latter) which is called when a new token is required. The role of the callback is to obtain a fresh token, one of: an Ably Token string (in plain text format); a signed [`TokenRequest`](/docs/api/realtime-sdk/types#token-request); a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) (in JSON format); an [Ably JWT](/docs/api/realtime-sdk/authentication#ably-jwt). See [our authentication documentation](/docs/platform/auth) for details of the Ably TokenRequest format and associated API calls. | `Callable``TokenCallback``Proc``Func>` | | authUrlAuthUrl:auth_url | A URL that the library may use to obtain a fresh token, one of: an Ably Token string (in plain text format); a signed [`TokenRequest`](/docs/api/realtime-sdk/types#token-request); a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) (in JSON format); an [Ably JWT](/docs/api/realtime-sdk/authentication#ably-jwt). For example, this can be used by a client to obtain signed Ably TokenRequests from an application server. | `String``Uri``NSURL``String` | | authMethodAuthMethod:auth_method | _`GET``:get`_ The HTTP verb to use for the request, either `GET``:get` or `POST``:post` | `String``Symbol``HttpMethod` | | authHeadersAuthHeaders:auth_headers | A set of key value pair headers to be added to any request made to the authUrlAuthUrl:auth_url. Useful when an application requires these to be added to validate the request or implement the response. If the `authHeaders` object contains an `authorization` key, then `withCredentials` will be set on the xhr request. | `Object``Hash``Param[]``Dictionary``Map` | | authParamsAuthParams:auth_params | A set of key value pair params to be added to any request made to the authUrlAuthUrl:auth_url. When the authMethodAuthMethod:auth_method is `GET`, query params are added to the URL, whereas when authMethodAuthMethod:auth_method is `POST`, the params are sent as URL encoded form data. Useful when an application require these to be added to validate the request or implement the response. | `Object``Hash``Param[]``Dictionary``NSArray``[NSURLQueryItem]/Array``Map` | -| tokenDetailsTokenDetails:token_details | An authenticated [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) object (most commonly obtained from an Ably Token Request response). This option is mostly useful for testing: since tokens are short-lived, in production you almost always want to use an authentication method that allows the client library to renew the token automatically when the previous one expires, such as authUrlAuthUrl:auth_url or authCallbackAuthCallback:auth_callback. Use this option if you wish to use Token authentication. Read more about [Token authentication](/docs/auth/token) | `TokenDetails` | -| keyKey:key | Optionally the [API key](/docs/auth#api-key) to use can be specified as a full key string; if not, the API key passed into [`ClientOptions`](#client-options) when instancing the Realtime or REST library is used | `String` | -| queryTimeQueryTime:query_time | _false_ If true, the library will query the Ably servers for the current time when [issuing TokenRequests](/docs/auth/token) instead of relying on a locally-available time of day. Knowing the time accurately is needed to create valid signed Ably [TokenRequests](/docs/auth/token), so this option is useful for library instances on auth servers where for some reason the server clock cannot be kept synchronized through normal means, such as an [NTP daemon](https://en.wikipedia.org/wiki/Ntpd). The server is queried for the current time once per client library instance (which stores the offset from the local clock), so if using this option you should avoid instancing a new version of the library for each request. | `Boolean` | -| tokenToken:token | An authenticated token. This can either be a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) object, a [`TokenRequest`](/docs/api/realtime-sdk/types#token-request) object, or token string (obtained from the tokenToken:token property of a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) component of an Ably TokenRequest response, or a [JSON Web Token](https://tools.ietf.org/html/rfc7519) satisfying [the Ably requirements for JWTs](/docs/auth/token#jwt)). This option is mostly useful for testing: since tokens are short-lived, in production you almost always want to use an authentication method that allows the client library to renew the token automatically when the previous one expires, such as authUrlAuthUrl:auth_url or authCallbackAuthCallback:auth_callback. Read more about [Token authentication](/docs/auth/token) | `String`, `TokenDetails` or `TokenRequest` | +| tokenDetailsTokenDetails:token_details | An authenticated [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) object (most commonly obtained from an Ably Token Request response). This option is mostly useful for testing: since tokens are short-lived, in production you almost always want to use an authentication method that allows the client library to renew the token automatically when the previous one expires, such as authUrlAuthUrl:auth_url or authCallbackAuthCallback:auth_callback. Use this option if you wish to use Token authentication. Read more about [Token authentication](/docs/platform/auth/token) | `TokenDetails` | +| keyKey:key | Optionally the [API key](/docs/platform/auth#api-key) to use can be specified as a full key string; if not, the API key passed into [`ClientOptions`](#client-options) when instancing the Realtime or REST library is used | `String` | +| queryTimeQueryTime:query_time | _false_ If true, the library will query the Ably servers for the current time when [issuing TokenRequests](/docs/platform/auth/token) instead of relying on a locally-available time of day. Knowing the time accurately is needed to create valid signed Ably [TokenRequests](/docs/platform/auth/token), so this option is useful for library instances on auth servers where for some reason the server clock cannot be kept synchronized through normal means, such as an [NTP daemon](https://en.wikipedia.org/wiki/Ntpd). The server is queried for the current time once per client library instance (which stores the offset from the local clock), so if using this option you should avoid instancing a new version of the library for each request. | `Boolean` | +| tokenToken:token | An authenticated token. This can either be a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) object, a [`TokenRequest`](/docs/api/realtime-sdk/types#token-request) object, or token string (obtained from the tokenToken:token property of a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) component of an Ably TokenRequest response, or a [JSON Web Token](https://tools.ietf.org/html/rfc7519) satisfying [the Ably requirements for JWTs](/docs/platform/auth/token#jwt)). This option is mostly useful for testing: since tokens are short-lived, in production you almost always want to use an authentication method that allows the client library to renew the token automatically when the previous one expires, such as authUrlAuthUrl:auth_url or authCallbackAuthCallback:auth_callback. Read more about [Token authentication](/docs/platform/auth/token) | `String`, `TokenDetails` or `TokenRequest` | ### ClientOptions ObjectARTClientOptionsClientOptions Hashio.ably.types.ClientOptionsIO.Ably.ClientOptions @@ -1919,17 +1919,17 @@ A `TokenRevocationFailureResult` contains information about the result of an uns | Property | Description | Type | |----------|-------------|------| -| key | The full key string, as obtained from the [application dashboard](https://ably.com/dashboard). Use this option if you wish to use Basic authentication, or wish to be able to issue Ably Tokens without needing to defer to a separate entity to sign Ably TokenRequests. Read more about [Basic authentication](/docs/auth/basic) | `String` | -| token | An authenticated [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) object, a [`TokenRequest`](/docs/api/realtime-sdk/types#token-request) object, or token string (obtained from the `token` property of a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) component of an Ably TokenRequest response, or a [JSON Web Token](https://tools.ietf.org/html/rfc7519) satisfying [the Ably requirements for JWTs](/docs/auth/token#jwt)). This option is mostly useful for testing: since tokens are short-lived, in production you almost always want to use an authentication method that allows the client library to renew the token automatically when the previous one expires, such as `authUrl` or `authCallback`. Read more about [Token authentication](/docs/auth/token) | `String`, `TokenDetails` or `TokenRequest` | -| authCallback | A function with the form `function(tokenParams, callback(err, tokenOrTokenRequest))` which is called when a new token is required. The role of the callback is to obtain a fresh token, one of: an Ably Token string (in plain text format); a signed [`TokenRequest`](/docs/api/realtime-sdk/types#token-request); a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) (in JSON format); an [Ably JWT](/docs/api/realtime-sdk/authentication#ably-jwt). See [our authentication documentation](/docs/auth) for details of the Ably TokenRequest format and associated API calls | `Callable` | +| key | The full key string, as obtained from the [application dashboard](https://ably.com/dashboard). Use this option if you wish to use Basic authentication, or wish to be able to issue Ably Tokens without needing to defer to a separate entity to sign Ably TokenRequests. Read more about [Basic authentication](/docs/platform/auth/basic) | `String` | +| token | An authenticated [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) object, a [`TokenRequest`](/docs/api/realtime-sdk/types#token-request) object, or token string (obtained from the `token` property of a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) component of an Ably TokenRequest response, or a [JSON Web Token](https://tools.ietf.org/html/rfc7519) satisfying [the Ably requirements for JWTs](/docs/platform/auth/token#jwt)). This option is mostly useful for testing: since tokens are short-lived, in production you almost always want to use an authentication method that allows the client library to renew the token automatically when the previous one expires, such as `authUrl` or `authCallback`. Read more about [Token authentication](/docs/platform/auth/token) | `String`, `TokenDetails` or `TokenRequest` | +| authCallback | A function with the form `function(tokenParams, callback(err, tokenOrTokenRequest))` which is called when a new token is required. The role of the callback is to obtain a fresh token, one of: an Ably Token string (in plain text format); a signed [`TokenRequest`](/docs/api/realtime-sdk/types#token-request); a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) (in JSON format); an [Ably JWT](/docs/api/realtime-sdk/authentication#ably-jwt). See [our authentication documentation](/docs/platform/auth) for details of the Ably TokenRequest format and associated API calls | `Callable` | | authUrl | A URL that the library may use to obtain a fresh token, one of: an Ably Token string (in plain text format); a signed [`TokenRequest`](/docs/api/realtime-sdk/types#token-request); a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) (in JSON format); an [Ably JWT](/docs/api/realtime-sdk/authentication#ably-jwt). For example, this can be used by a client to obtain signed Ably TokenRequests from an application server | `String` | | authMethod | The HTTP verb to use for the request, either `GET` or `POST`
**Default:** `GET` | `String` | | authHeaders | A set of key value pair headers to be added to any request made to the `authUrl`. Useful when an application requires these to be added to validate the request or implement the response. If the `authHeaders` object contains an `authorization` key, then `withCredentials` will be set on the xhr request | `Object` | | authParams | A set of key value pair params to be added to any request made to the `authUrl`. When the `authMethod` is `GET`, query params are added to the URL, whereas when `authMethod` is `POST`, the params are sent as URL encoded form data. Useful when an application require these to be added to validate the request or implement the response | `Object` | -| tokenDetails | An authenticated [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) object (most commonly obtained from an Ably Token Request response). This option is mostly useful for testing: since tokens are short-lived, in production you almost always want to use an authentication method that allows the client library to renew the token automatically when the previous one expires, such as `authUrl` or `authCallback`. Use this option if you wish to use Token authentication. Read more about [Token authentication](/docs/auth/token) | `TokenDetails` | +| tokenDetails | An authenticated [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) object (most commonly obtained from an Ably Token Request response). This option is mostly useful for testing: since tokens are short-lived, in production you almost always want to use an authentication method that allows the client library to renew the token automatically when the previous one expires, such as `authUrl` or `authCallback`. Use this option if you wish to use Token authentication. Read more about [Token authentication](/docs/platform/auth/token) | `TokenDetails` | | tls | A boolean value, indicating whether or not a TLS ("SSL") secure connection should be used. An insecure connection cannot be used with Basic authentication as it would lead to a possible compromise of the private API key while in transit. [Find out more about TLS](https://faqs.ably.com/are-messages-sent-to-and-received-from-ably-securely-using-tls)
**Default:** true | `Boolean` | -| clientId | A client ID, used for identifying this client when publishing messages or for presence purposes. The `clientId` can be any non-empty string. This option is primarily intended to be used in situations where the library is instantiated with a key; note that a `clientId` may also be implicit in a token used to instantiate the library; an error will be raised if a `clientId` specified here conflicts with the `clientId` implicit in the token. [Find out more about client identities](/docs/auth/identified-clients) | `String` | -| useTokenAuth | When true, forces [Token authentication](/docs/auth/token) to be used by the library. Please note that if a `clientId` is not specified in the [`ClientOptions`](/docs/api/realtime-sdk/types#client-options) or [`TokenParams`](/docs/api/realtime-sdk/types#token-params), then the Ably Token issued will be [anonymous](https://faqs.ably.com/authenticated-and-identified-clients)
**Default:** false | `Boolean` | +| clientId | A client ID, used for identifying this client when publishing messages or for presence purposes. The `clientId` can be any non-empty string. This option is primarily intended to be used in situations where the library is instantiated with a key; note that a `clientId` may also be implicit in a token used to instantiate the library; an error will be raised if a `clientId` specified here conflicts with the `clientId` implicit in the token. [Find out more about client identities](/docs/platform/auth/identified-clients) | `String` | +| useTokenAuth | When true, forces [Token authentication](/docs/platform/auth/token) to be used by the library. Please note that if a `clientId` is not specified in the [`ClientOptions`](/docs/api/realtime-sdk/types#client-options) or [`TokenParams`](/docs/api/realtime-sdk/types#token-params), then the Ably Token issued will be [anonymous](https://faqs.ably.com/authenticated-and-identified-clients)
**Default:** false | `Boolean` | | endpoint | Enables [enterprise customers](https://ably.com/pricing) to use their own custom endpoints, which support dedicated, isolated clusters and regional message routing and storage constraints. See our [platform customization guide](/docs/platform/account/enterprise-customization) for more details
**Default:** null | `String` | | environment | Deprecated, use `endpoint`. Enables [enterprise customers](https://ably.com/pricing) to use their own custom environments, which support dedicated, isolated clusters and regional message routing and storage constraints. See our [platform customization guide](/docs/platform/account/enterprise-customization) for more details
**Default:** null | `String` | | idempotentRestPublishing | When true, enables idempotent publishing by assigning a unique message ID client-side, allowing the Ably servers to discard automatic publish retries following a failure such as a network fault. We recommend you enable this by default. In version 1.2 onwards, idempotent publishing for retries will be enabled by default
**Default:** false | `Boolean` | @@ -1944,7 +1944,7 @@ A `TokenRevocationFailureResult` contains information about the result of an uns | transports | An optional array of transports to use, in descending order of preference. In the browser environment the available transports are: `web_socket`, `xhr_polling`The transports available in the Node.js client library are: `web_socket`, `xhr_polling`, `comet` | `String[]` | | recover | This option allows a connection to inherit the state of a previous connection that may have existed under a different instance of the Realtime library. This might typically be used by clients of the browser library to ensure connection state can be preserved when the user refreshes the page. A recovery key string can be explicitly provided, or alternatively if a callback function is provided, the client library will automatically persist the recovery key between page reloads and call the callback when the connection is recoverable. The callback is then responsible for confirming whether the connection should be recovered or not. See [connection state recovery](/docs/connect/states) for further informationThis option allows a connection to inherit the state of a previous connection that may have existed under a different instance of the library by providing that connection's [`recoveryKey`](/docs/api/realtime-sdk/connection#recovery-key). This might typically be used by clients of an app to ensure connection state can be preserved following a reload. See [connection state recovery](/docs/connect/states) for further information and example code | `String`, `Callable``String` | | closeOnUnload | When true, the client library will automatically send a close request to Ably whenever the `window beforeunload` event fires. By enabling this option, the close request sent to Ably ensures the connection state will not be retained and all channels associated with the connection will be detached. This is commonly used by developers who want presence leave events to fire immediately i.e. if a user navigates to another page or closes their browser, then enabling this option will result in the presence member leaving immediately. Without this option or an explicit call to the [`close`](/docs/api/realtime-sdk/connection#close) method of the [`Connection object`](/docs/api/realtime-sdk/connection), Ably expects that the abruptly disconnected connection could later be recovered and therefore does not immediately remove the user from presence. Instead, to avoid "twitchy" presence behavior an abruptly disconnected client is removed from channels in which they are present after 15 seconds, and the connection state is retained for two minutes
**Default:** true
| `Boolean` | -| queryTime | If true, the library will query the Ably servers for the current time when [issuing TokenRequests](/docs/auth/token) instead of relying on a locally-available time of day. Knowing the time accurately is needed to create valid signed Ably [TokenRequests](/docs/api/realtime-sdk/authentication#request-token), so this option is useful for library instances on auth servers where for some reason the server clock cannot be kept synchronized through normal means, such as an [NTP daemon](https://en.wikipedia.org/wiki/Ntpd). The server is queried for the current time once per client library instance (which stores the offset from the local clock), so if using this option you should avoid instancing a new version of the library for each request
**Default:** false | `Boolean` | +| queryTime | If true, the library will query the Ably servers for the current time when [issuing TokenRequests](/docs/platform/auth/token) instead of relying on a locally-available time of day. Knowing the time accurately is needed to create valid signed Ably [TokenRequests](/docs/api/realtime-sdk/authentication#request-token), so this option is useful for library instances on auth servers where for some reason the server clock cannot be kept synchronized through normal means, such as an [NTP daemon](https://en.wikipedia.org/wiki/Ntpd). The server is queried for the current time once per client library instance (which stores the offset from the local clock), so if using this option you should avoid instancing a new version of the library for each request
**Default:** false | `Boolean` | | defaultTokenParams | When a [TokenParams](/docs/api/realtime-sdk/types#token-params) object is provided, it will override the client library defaults when issuing new Ably Tokens or Ably TokenRequests | [`TokenParams`](/docs/api/realtime-sdk/types#token-params) | | disconnectedRetryTimeout | When the connection enters the `DISCONNECTED` state, after this delay in milliseconds, if the state is still `DISCONNECTED`, the client library will attempt to reconnect automatically
**Default:** 15,000ms | `Integer` | | suspendedRetryTimeout | When the connection enters the `SUSPENDED` state, after this delay in milliseconds, if the state is still `SUSPENDED`, the client library will attempt to reconnect automatically
**Default:** 30,000ms | `Integer` | @@ -1956,17 +1956,17 @@ A `TokenRevocationFailureResult` contains information about the result of an uns | Property | Description | Type | |----------|-------------|------| -| Key | The full key string, as obtained from the [application dashboard](https://ably.com/dashboard). Use this option if you wish to use Basic authentication, or wish to be able to issue Ably Tokens without needing to defer to a separate entity to sign Ably TokenRequests. Read more about [Basic authentication](/docs/auth/basic) | `String` | -| Token | An authenticated [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) object, a [`TokenRequest`](/docs/api/realtime-sdk/types#token-request) object, or token string (obtained from the `Token` property of a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) component of an Ably TokenRequest response, or a [JSON Web Token](https://tools.ietf.org/html/rfc7519) satisfying [the Ably requirements for JWTs](/docs/auth/token#jwt)). This option is mostly useful for testing: since tokens are short-lived, in production you almost always want to use an authentication method that allows the client library to renew the token automatically when the previous one expires, such as `AuthUrl` or `AuthCallback`. Read more about [Token authentication](/docs/auth/token) | `String`, `TokenDetails` or `TokenRequest` | -| AuthCallback | A function which is called when a new token is required. The role of the callback is to obtain a fresh token, one of: an Ably Token string (in plain text format); a signed [`TokenRequest`](/docs/api/realtime-sdk/types#token-request); a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) (in JSON format); an [Ably JWT](/docs/api/realtime-sdk/authentication#ably-jwt). See [our authentication documentation](/docs/auth) for details of the Ably TokenRequest format and associated API calls | `Func>` | +| Key | The full key string, as obtained from the [application dashboard](https://ably.com/dashboard). Use this option if you wish to use Basic authentication, or wish to be able to issue Ably Tokens without needing to defer to a separate entity to sign Ably TokenRequests. Read more about [Basic authentication](/docs/platform/auth/basic) | `String` | +| Token | An authenticated [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) object, a [`TokenRequest`](/docs/api/realtime-sdk/types#token-request) object, or token string (obtained from the `Token` property of a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) component of an Ably TokenRequest response, or a [JSON Web Token](https://tools.ietf.org/html/rfc7519) satisfying [the Ably requirements for JWTs](/docs/platform/auth/token#jwt)). This option is mostly useful for testing: since tokens are short-lived, in production you almost always want to use an authentication method that allows the client library to renew the token automatically when the previous one expires, such as `AuthUrl` or `AuthCallback`. Read more about [Token authentication](/docs/platform/auth/token) | `String`, `TokenDetails` or `TokenRequest` | +| AuthCallback | A function which is called when a new token is required. The role of the callback is to obtain a fresh token, one of: an Ably Token string (in plain text format); a signed [`TokenRequest`](/docs/api/realtime-sdk/types#token-request); a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) (in JSON format); an [Ably JWT](/docs/api/realtime-sdk/authentication#ably-jwt). See [our authentication documentation](/docs/platform/auth) for details of the Ably TokenRequest format and associated API calls | `Func>` | | AuthUrl | A URL that the library may use to obtain a fresh token, one of: an Ably Token string (in plain text format); a signed [`TokenRequest`](/docs/api/realtime-sdk/types#token-request); a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) (in JSON format); an [Ably JWT](/docs/api/realtime-sdk/authentication#ably-jwt). For example, this can be used by a client to obtain signed Ably TokenRequests from an application server | `Uri` | | AuthMethod | The HTTP verb to use for the request, either `GET` or `POST`
**Default:** `GET` | `HttpMethod` | | AuthHeaders | A set of key value pair headers to be added to any request made to the `AuthUrl`. Useful when an application requires these to be added to validate the request or implement the response | `Dictionary` | | AuthParams | A set of key value pair params to be added to any request made to the `AuthUrl`. When the `AuthMethod` is `GET`, query params are added to the URL, whereas when `AuthMethod` is `POST`, the params are sent as URL encoded form data. Useful when an application require these to be added to validate the request or implement the response | `Dictionary` | -| TokenDetails | An authenticated [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) object (most commonly obtained from an Ably Token Request response). This option is mostly useful for testing: since tokens are short-lived, in production you almost always want to use an authentication method that allows the client library to renew the token automatically when the previous one expires, such as `AuthUrl` or `AuthCallback`. Use this option if you wish to use Token authentication. Read more about [Token authentication](/docs/auth/token) | `TokenDetails` | +| TokenDetails | An authenticated [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) object (most commonly obtained from an Ably Token Request response). This option is mostly useful for testing: since tokens are short-lived, in production you almost always want to use an authentication method that allows the client library to renew the token automatically when the previous one expires, such as `AuthUrl` or `AuthCallback`. Use this option if you wish to use Token authentication. Read more about [Token authentication](/docs/platform/auth/token) | `TokenDetails` | | Tls | A boolean value, indicating whether or not a TLS ("SSL") secure connection should be used. An insecure connection cannot be used with Basic authentication as it would lead to a possible compromise of the private API key while in transit. [Find out more about TLS](https://faqs.ably.com/are-messages-sent-to-and-received-from-ably-securely-using-tls)
**Default:** true | `Boolean` | -| ClientId | A client ID, used for identifying this client when publishing messages or for presence purposes. The `ClientId` can be any non-empty string. This option is primarily intended to be used in situations where the library is instantiated with a key; note that a `ClientId` may also be implicit in a token used to instantiate the library; an error will be raised if a `ClientId` specified here conflicts with the `ClientId` implicit in the token. [Find out more about client identities](/docs/auth/identified-clients) | `String` | -| UseTokenAuth | When true, forces [Token authentication](/docs/auth/token) to be used by the library. Please note that if a `clientId` is not specified in the [`ClientOptions`](/docs/api/realtime-sdk/types#client-options) or [`TokenParams`](/docs/api/realtime-sdk/types#token-params), then the Ably Token issued will be [anonymous](https://faqs.ably.com/authenticated-and-identified-clients)
**Default:** false | `Boolean` | +| ClientId | A client ID, used for identifying this client when publishing messages or for presence purposes. The `ClientId` can be any non-empty string. This option is primarily intended to be used in situations where the library is instantiated with a key; note that a `ClientId` may also be implicit in a token used to instantiate the library; an error will be raised if a `ClientId` specified here conflicts with the `ClientId` implicit in the token. [Find out more about client identities](/docs/platform/auth/identified-clients) | `String` | +| UseTokenAuth | When true, forces [Token authentication](/docs/platform/auth/token) to be used by the library. Please note that if a `clientId` is not specified in the [`ClientOptions`](/docs/api/realtime-sdk/types#client-options) or [`TokenParams`](/docs/api/realtime-sdk/types#token-params), then the Ably Token issued will be [anonymous](https://faqs.ably.com/authenticated-and-identified-clients)
**Default:** false | `Boolean` | | Endpoint | Enables [enterprise customers](https://ably.com/pricing) to use their own custom endpoints, which support dedicated, isolated clusters and regional message routing and storage constraints. See our [platform customization guide](/docs/platform/account/enterprise-customization) for more details
**Default:** null | `String` | | Environment | Deprecated, use `endpoint`. Enables [enterprise customers](https://ably.com/pricing) to use their own custom environments, which support dedicated, isolated clusters and regional message routing and storage constraints. See our [platform customization guide](/docs/platform/account/enterprise-customization) for more details
**Default:** null | `String` | | IdempotentRestPublishing | When true, enables idempotent publishing by assigning a unique message ID client-side, allowing the Ably servers to discard automatic publish retries following a failure such as a network fault. We recommend you enable this by default. In version 1.2 onwards, idempotent publishing for retries will be enabled by default
**Default:** false | `Boolean` | @@ -1979,7 +1979,7 @@ A `TokenRevocationFailureResult` contains information about the result of an uns | EchoMessages | If false, prevents messages originating from this connection being echoed back on the same connection
**Default:** true | `Boolean` | | AutoConnect | By default as soon as the client library is instantiated it will connect to Ably. You can optionally set this to false and explicitly connect to Ably when require using the [`connect`](/docs/api/realtime-sdk/connection#connect) method
**Default:** true | `Boolean` | | Recover | This option allows a connection to inherit the state of a previous connection that may have existed under a different instance of the library by providing that connection's [`recoveryKey`](/docs/api/realtime-sdk/connection#recovery-key). This might typically be used by clients of an app to ensure connection state can be preserved following a reload. See [connection state recovery](/docs/connect/states) for further information and example code | `String` | -| QueryTime | If true, the library will query the Ably servers for the current time when [issuing TokenRequests](/docs/auth/token) instead of relying on a locally-available time of day. Knowing the time accurately is needed to create valid signed Ably [TokenRequests](/docs/api/realtime-sdk/authentication#request-token), so this option is useful for library instances on auth servers where for some reason the server clock cannot be kept synchronized through normal means, such as an [NTP daemon](https://en.wikipedia.org/wiki/Ntpd). The server is queried for the current time once per client library instance (which stores the offset from the local clock), so if using this option you should avoid instancing a new version of the library for each request
**Default:** false | `Boolean` | +| QueryTime | If true, the library will query the Ably servers for the current time when [issuing TokenRequests](/docs/platform/auth/token) instead of relying on a locally-available time of day. Knowing the time accurately is needed to create valid signed Ably [TokenRequests](/docs/api/realtime-sdk/authentication#request-token), so this option is useful for library instances on auth servers where for some reason the server clock cannot be kept synchronized through normal means, such as an [NTP daemon](https://en.wikipedia.org/wiki/Ntpd). The server is queried for the current time once per client library instance (which stores the offset from the local clock), so if using this option you should avoid instancing a new version of the library for each request
**Default:** false | `Boolean` | | DefaultTokenParams | When a [TokenParams](/docs/api/realtime-sdk/types#token-params) object is provided, it will override the client library defaults when issuing new Ably Tokens or Ably TokenRequests | [`TokenParams`](/docs/api/realtime-sdk/types#token-params) | | DisconnectedRetryTimeout | When the connection enters the `DISCONNECTED` state, after this delay in milliseconds, if the state is still `DISCONNECTED`, the client library will attempt to reconnect automatically
**Default:** 15,000ms | `Integer` | | SuspendedRetryTimeout | When the connection enters the `SUSPENDED` state, after this delay in milliseconds, if the state is still `SUSPENDED`, the client library will attempt to reconnect automatically
**Default:** 30,000ms | `Integer` | @@ -1990,17 +1990,17 @@ A `TokenRevocationFailureResult` contains information about the result of an uns | Property | Description | Type | |----------|-------------|------| -| key | The full key string, as obtained from the [application dashboard](https://ably.com/dashboard). Use this option if you wish to use Basic authentication, or wish to be able to issue Ably Tokens without needing to defer to a separate entity to sign Ably TokenRequests. Read more about [Basic authentication](/docs/auth/basic) | `String` | -| token | An authenticated [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) object, a [`TokenRequest`](/docs/api/realtime-sdk/types#token-request) object, or token string (obtained from the `token` property of a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) component of an Ably TokenRequest response, or a [JSON Web Token](https://tools.ietf.org/html/rfc7519) satisfying [the Ably requirements for JWTs](/docs/auth/token#jwt)). This option is mostly useful for testing: since tokens are short-lived, in production you almost always want to use an authentication method that allows the client library to renew the token automatically when the previous one expires, such as `authUrl` or `authCallback`. Read more about [Token authentication](/docs/auth/token) | `String`, `TokenDetails` or `TokenRequest` | -| authCallback | A `TokenCallback` instance which is called when a new token is required. The role of the callback is to obtain a fresh token, one of: an Ably Token string (in plain text format); a signed [`TokenRequest`](/docs/api/realtime-sdk/types#token-request); a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) (in JSON format); an [Ably JWT](/docs/api/realtime-sdk/authentication#ably-jwt). See [our authentication documentation](/docs/auth) for details of the Ably TokenRequest format and associated API calls | `TokenCallback` | +| key | The full key string, as obtained from the [application dashboard](https://ably.com/dashboard). Use this option if you wish to use Basic authentication, or wish to be able to issue Ably Tokens without needing to defer to a separate entity to sign Ably TokenRequests. Read more about [Basic authentication](/docs/platform/auth/basic) | `String` | +| token | An authenticated [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) object, a [`TokenRequest`](/docs/api/realtime-sdk/types#token-request) object, or token string (obtained from the `token` property of a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) component of an Ably TokenRequest response, or a [JSON Web Token](https://tools.ietf.org/html/rfc7519) satisfying [the Ably requirements for JWTs](/docs/platform/auth/token#jwt)). This option is mostly useful for testing: since tokens are short-lived, in production you almost always want to use an authentication method that allows the client library to renew the token automatically when the previous one expires, such as `authUrl` or `authCallback`. Read more about [Token authentication](/docs/platform/auth/token) | `String`, `TokenDetails` or `TokenRequest` | +| authCallback | A `TokenCallback` instance which is called when a new token is required. The role of the callback is to obtain a fresh token, one of: an Ably Token string (in plain text format); a signed [`TokenRequest`](/docs/api/realtime-sdk/types#token-request); a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) (in JSON format); an [Ably JWT](/docs/api/realtime-sdk/authentication#ably-jwt). See [our authentication documentation](/docs/platform/auth) for details of the Ably TokenRequest format and associated API calls | `TokenCallback` | | authUrl | A URL that the library may use to obtain a fresh token, one of: an Ably Token string (in plain text format); a signed [`TokenRequest`](/docs/api/realtime-sdk/types#token-request); a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) (in JSON format); an [Ably JWT](/docs/api/realtime-sdk/authentication#ably-jwt). For example, this can be used by a client to obtain signed Ably TokenRequests from an application server | `String` | | authMethod | The HTTP verb to use for the request, either `GET` or `POST`
**Default:** `GET` | `String` | | authHeaders | A set of key value pair headers to be added to any request made to the `authUrl`. Useful when an application requires these to be added to validate the request or implement the response | `Param[]` | | authParams | A set of key value pair params to be added to any request made to the `authUrl`. When the `authMethod` is `GET`, query params are added to the URL, whereas when `authMethod` is `POST`, the params are sent as URL encoded form data. Useful when an application require these to be added to validate the request or implement the response | `Param[]` | -| tokenDetails | An authenticated [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) object (most commonly obtained from an Ably Token Request response). This option is mostly useful for testing: since tokens are short-lived, in production you almost always want to use an authentication method that allows the client library to renew the token automatically when the previous one expires, such as `authUrl` or `authCallback`. Use this option if you wish to use Token authentication. Read more about [Token authentication](/docs/auth/token) | `TokenDetails` | +| tokenDetails | An authenticated [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) object (most commonly obtained from an Ably Token Request response). This option is mostly useful for testing: since tokens are short-lived, in production you almost always want to use an authentication method that allows the client library to renew the token automatically when the previous one expires, such as `authUrl` or `authCallback`. Use this option if you wish to use Token authentication. Read more about [Token authentication](/docs/platform/auth/token) | `TokenDetails` | | tls | A boolean value, indicating whether or not a TLS ("SSL") secure connection should be used. An insecure connection cannot be used with Basic authentication as it would lead to a possible compromise of the private API key while in transit. [Find out more about TLS](https://faqs.ably.com/are-messages-sent-to-and-received-from-ably-securely-using-tls)
**Default:** true | `Boolean` | -| clientId | A client ID, used for identifying this client when publishing messages or for presence purposes. The `clientId` can be any non-empty string. This option is primarily intended to be used in situations where the library is instantiated with a key; note that a `clientId` may also be implicit in a token used to instantiate the library; an error will be raised if a `clientId` specified here conflicts with the `clientId` implicit in the token. [Find out more about client identities](/docs/auth/identified-clients) | `String` | -| useTokenAuth | When true, forces [Token authentication](/docs/auth/token) to be used by the library. Please note that if a `clientId` is not specified in the [`ClientOptions`](/docs/api/realtime-sdk/types#client-options) or [`TokenParams`](/docs/api/realtime-sdk/types#token-params), then the Ably Token issued will be [anonymous](https://faqs.ably.com/authenticated-and-identified-clients)
**Default:** false | `Boolean` | +| clientId | A client ID, used for identifying this client when publishing messages or for presence purposes. The `clientId` can be any non-empty string. This option is primarily intended to be used in situations where the library is instantiated with a key; note that a `clientId` may also be implicit in a token used to instantiate the library; an error will be raised if a `clientId` specified here conflicts with the `clientId` implicit in the token. [Find out more about client identities](/docs/platform/auth/identified-clients) | `String` | +| useTokenAuth | When true, forces [Token authentication](/docs/platform/auth/token) to be used by the library. Please note that if a `clientId` is not specified in the [`ClientOptions`](/docs/api/realtime-sdk/types#client-options) or [`TokenParams`](/docs/api/realtime-sdk/types#token-params), then the Ably Token issued will be [anonymous](https://faqs.ably.com/authenticated-and-identified-clients)
**Default:** false | `Boolean` | | endpoint | Enables [enterprise customers](https://ably.com/pricing) to use their own custom endpoints, which support dedicated, isolated clusters and regional message routing and storage constraints. See our [platform customization guide](/docs/platform/account/enterprise-customization) for more details
**Default:** Null | `String` | | environment | Deprecated, use `endpoint`. Enables [enterprise customers](https://ably.com/pricing) to use their own custom environments, which support dedicated, isolated clusters and regional message routing and storage constraints. See our [platform customization guide](/docs/platform/account/enterprise-customization) for more details
**Default:** Null | `String` | | idempotentRestPublishing | When true, enables idempotent publishing by assigning a unique message ID client-side, allowing the Ably servers to discard automatic publish retries following a failure such as a network fault. We recommend you enable this by default. In version 1.2 onwards, idempotent publishing for retries will be enabled by default
**Default:** false | `Boolean` | @@ -2013,7 +2013,7 @@ A `TokenRevocationFailureResult` contains information about the result of an uns | echoMessages | If false, prevents messages originating from this connection being echoed back on the same connection
**Default:** true | `Boolean` | | autoConnect | By default as soon as the client library is instantiated it will connect to Ably. You can optionally set this to false and explicitly connect to Ably when require using the [`connect`](/docs/api/realtime-sdk/connection#connect) method
**Default:** true | `Boolean` | | recover | This option allows a connection to inherit the state of a previous connection that may have existed under a different instance of the library by providing that connection's [`recoveryKey`](/docs/api/realtime-sdk/connection#recovery-key). This might typically be used by clients of an app to ensure connection state can be preserved following a reload. See [connection state recovery](/docs/connect/states) for further information and example code | `String` | -| queryTime | If true, the library will query the Ably servers for the current time when [issuing TokenRequests](/docs/auth/token) instead of relying on a locally-available time of day. Knowing the time accurately is needed to create valid signed Ably [TokenRequests](/docs/api/realtime-sdk/authentication#request-token), so this option is useful for library instances on auth servers where for some reason the server clock cannot be kept synchronized through normal means, such as an [NTP daemon](https://en.wikipedia.org/wiki/Ntpd). The server is queried for the current time once per client library instance (which stores the offset from the local clock), so if using this option you should avoid instancing a new version of the library for each request
**Default:** false | `Boolean` | +| queryTime | If true, the library will query the Ably servers for the current time when [issuing TokenRequests](/docs/platform/auth/token) instead of relying on a locally-available time of day. Knowing the time accurately is needed to create valid signed Ably [TokenRequests](/docs/api/realtime-sdk/authentication#request-token), so this option is useful for library instances on auth servers where for some reason the server clock cannot be kept synchronized through normal means, such as an [NTP daemon](https://en.wikipedia.org/wiki/Ntpd). The server is queried for the current time once per client library instance (which stores the offset from the local clock), so if using this option you should avoid instancing a new version of the library for each request
**Default:** false | `Boolean` | | defaultTokenParams | When a [TokenParams](/docs/api/realtime-sdk/types#token-params) object is provided, it will override the client library defaults when issuing new Ably Tokens or Ably TokenRequests | [`TokenParams`](/docs/api/realtime-sdk/types#token-params) | | disconnectedRetryTimeout | When the connection enters the `DISCONNECTED` state, after this delay in milliseconds, if the state is still `DISCONNECTED`, the client library will attempt to reconnect automatically
**Default:** 15,000ms | `Integer` | | suspendedRetryTimeout | When the connection enters the `SUSPENDED` state, after this delay in milliseconds, if the state is still `SUSPENDED`, the client library will attempt to reconnect automatically
**Default:** 30,000ms | `Integer` | @@ -2024,17 +2024,17 @@ A `TokenRevocationFailureResult` contains information about the result of an uns | Property | Description | Type | |----------|-------------|------| -| :key | The full key string, as obtained from the [application dashboard](https://ably.com/dashboard). Use this option if you wish to use Basic authentication, or wish to be able to issue Ably Tokens without needing to defer to a separate entity to sign Ably TokenRequests. Read more about [Basic authentication](/docs/auth/basic) | `String` | -| :token | An authenticated [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) object, a [`TokenRequest`](/docs/api/realtime-sdk/types#token-request) object, or token string (obtained from the :token property of a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) component of an Ably TokenRequest response, or a [JSON Web Token](https://tools.ietf.org/html/rfc7519) satisfying [the Ably requirements for JWTs](/docs/auth/token#jwt)). This option is mostly useful for testing: since tokens are short-lived, in production you almost always want to use an authentication method that allows the client library to renew the token automatically when the previous one expires, such as :auth_url or :auth_callback. Read more about [Token authentication](/docs/auth/token) | `String`, `TokenDetails` or `TokenRequest` | -| :auth_callback | A proc / lambda (called synchronously in REST and Realtime but does not block EventMachine in the latter) which is called when a new token is required. The role of the callback is to obtain a fresh token, one of: an Ably Token string (in plain text format); a signed [`TokenRequest`](/docs/api/realtime-sdk/types#token-request); a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) (in JSON format); an [Ably JWT](/docs/api/realtime-sdk/authentication#ably-jwt). See [our authentication documentation](/docs/auth) for details of the Ably TokenRequest format and associated API calls | `Proc` | +| :key | The full key string, as obtained from the [application dashboard](https://ably.com/dashboard). Use this option if you wish to use Basic authentication, or wish to be able to issue Ably Tokens without needing to defer to a separate entity to sign Ably TokenRequests. Read more about [Basic authentication](/docs/platform/auth/basic) | `String` | +| :token | An authenticated [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) object, a [`TokenRequest`](/docs/api/realtime-sdk/types#token-request) object, or token string (obtained from the :token property of a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) component of an Ably TokenRequest response, or a [JSON Web Token](https://tools.ietf.org/html/rfc7519) satisfying [the Ably requirements for JWTs](/docs/platform/auth/token#jwt)). This option is mostly useful for testing: since tokens are short-lived, in production you almost always want to use an authentication method that allows the client library to renew the token automatically when the previous one expires, such as :auth_url or :auth_callback. Read more about [Token authentication](/docs/platform/auth/token) | `String`, `TokenDetails` or `TokenRequest` | +| :auth_callback | A proc / lambda (called synchronously in REST and Realtime but does not block EventMachine in the latter) which is called when a new token is required. The role of the callback is to obtain a fresh token, one of: an Ably Token string (in plain text format); a signed [`TokenRequest`](/docs/api/realtime-sdk/types#token-request); a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) (in JSON format); an [Ably JWT](/docs/api/realtime-sdk/authentication#ably-jwt). See [our authentication documentation](/docs/platform/auth) for details of the Ably TokenRequest format and associated API calls | `Proc` | | :auth_url | A URL that the library may use to obtain a fresh token, one of: an Ably Token string (in plain text format); a signed [`TokenRequest`](/docs/api/realtime-sdk/types#token-request); a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) (in JSON format); an [Ably JWT](/docs/api/realtime-sdk/authentication#ably-jwt). For example, this can be used by a client to obtain signed Ably TokenRequests from an application server | `String` | | :auth_method | The HTTP verb to use for the request, either `:get` or `:post`
**Default:** `:get` | `Symbol` | | :auth_headers | A set of key value pair headers to be added to any request made to the :auth_url. Useful when an application requires these to be added to validate the request or implement the response | `Hash` | | :auth_params | A set of key value pair params to be added to any request made to the :auth_url. When the :auth_method is `GET`, query params are added to the URL, whereas when :auth_method is `POST`, the params are sent as URL encoded form data. Useful when an application require these to be added to validate the request or implement the response | `Hash` | -| :token_details | An authenticated [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) object (most commonly obtained from an Ably Token Request response). This option is mostly useful for testing: since tokens are short-lived, in production you almost always want to use an authentication method that allows the client library to renew the token automatically when the previous one expires, such as :auth_url or :auth_callback. Use this option if you wish to use Token authentication. Read more about [Token authentication](/docs/auth/token) | `TokenDetails` | +| :token_details | An authenticated [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) object (most commonly obtained from an Ably Token Request response). This option is mostly useful for testing: since tokens are short-lived, in production you almost always want to use an authentication method that allows the client library to renew the token automatically when the previous one expires, such as :auth_url or :auth_callback. Use this option if you wish to use Token authentication. Read more about [Token authentication](/docs/platform/auth/token) | `TokenDetails` | | :tls | A boolean value, indicating whether or not a TLS ("SSL") secure connection should be used. An insecure connection cannot be used with Basic authentication as it would lead to a possible compromise of the private API key while in transit. [Find out more about TLS](https://faqs.ably.com/are-messages-sent-to-and-received-from-ably-securely-using-tls)
**Default:** true | `Boolean` | -| :client_id | A client ID, used for identifying this client when publishing messages or for presence purposes. The `client_id` can be any non-empty string. This option is primarily intended to be used in situations where the library is instantiated with a key; note that a `client_id` may also be implicit in a token used to instantiate the library; an error will be raised if a `client_id` specified here conflicts with the `client_id` implicit in the token. [Find out more about client identities](/docs/auth/identified-clients) | `String` | -| :use_token_auth | When true, forces [Token authentication](/docs/auth/token) to be used by the library. Please note that if a `client_id` is not specified in the [`ClientOptions`](/docs/api/realtime-sdk/types#client-options) or [`TokenParams`](/docs/api/realtime-sdk/types#token-params), then the Ably Token issued will be [anonymous](https://faqs.ably.com/authenticated-and-identified-clients)
**Default:** false | `Boolean` | +| :client_id | A client ID, used for identifying this client when publishing messages or for presence purposes. The `client_id` can be any non-empty string. This option is primarily intended to be used in situations where the library is instantiated with a key; note that a `client_id` may also be implicit in a token used to instantiate the library; an error will be raised if a `client_id` specified here conflicts with the `client_id` implicit in the token. [Find out more about client identities](/docs/platform/auth/identified-clients) | `String` | +| :use_token_auth | When true, forces [Token authentication](/docs/platform/auth/token) to be used by the library. Please note that if a `client_id` is not specified in the [`ClientOptions`](/docs/api/realtime-sdk/types#client-options) or [`TokenParams`](/docs/api/realtime-sdk/types#token-params), then the Ably Token issued will be [anonymous](https://faqs.ably.com/authenticated-and-identified-clients)
**Default:** false | `Boolean` | | :endpoint | Enables [enterprise customers](https://ably.com/pricing) to use their own custom endpoints, which support dedicated, isolated clusters and regional message routing and storage constraints. See our [platform customization guide](/docs/platform/account/enterprise-customization) for more details
**Default:** nil | `String` | | :environment | Deprecated, use `endpoint`. Enables [enterprise customers](https://ably.com/pricing) to use their own custom environments, which support dedicated, isolated clusters and regional message routing and storage constraints. See our [platform customization guide](/docs/platform/account/enterprise-customization) for more details
**Default:** nil | `String` | | :idempotent_rest_publishing | When true, enables idempotent publishing by assigning a unique message ID client-side, allowing the Ably servers to discard automatic publish retries following a failure such as a network fault. We recommend you enable this by default. In version 1.2 onwards, idempotent publishing for retries will be enabled by default
**Default:** false | `Boolean` | @@ -2047,7 +2047,7 @@ A `TokenRevocationFailureResult` contains information about the result of an uns | :echo_messages | If false, prevents messages originating from this connection being echoed back on the same connection
**Default:** true | `Boolean` | | :auto_connect | By default as soon as the client library is instantiated it will connect to Ably. You can optionally set this to false and explicitly connect to Ably when require using the [`connect`](/docs/api/realtime-sdk/connection#connect) method
**Default:** true | `Boolean` | | :recover | This option allows a connection to inherit the state of a previous connection that may have existed under a different instance of the library by providing that connection's [`recovery_key`](/docs/api/realtime-sdk/connection#recovery-key). This might typically be used by clients of an app to ensure connection state can be preserved following a reload. See [connection state recovery](/docs/connect/states) for further information and example code | `String` | -| :query_time | If true, the library will query the Ably servers for the current time when [issuing TokenRequests](/docs/auth/token) instead of relying on a locally-available time of day. Knowing the time accurately is needed to create valid signed Ably [TokenRequests](/docs/api/realtime-sdk/authentication#request-token), so this option is useful for library instances on auth servers where for some reason the server clock cannot be kept synchronized through normal means, such as an [NTP daemon](https://en.wikipedia.org/wiki/Ntpd). The server is queried for the current time once per client library instance (which stores the offset from the local clock), so if using this option you should avoid instancing a new version of the library for each request
**Default:** false | `Boolean` | +| :query_time | If true, the library will query the Ably servers for the current time when [issuing TokenRequests](/docs/platform/auth/token) instead of relying on a locally-available time of day. Knowing the time accurately is needed to create valid signed Ably [TokenRequests](/docs/api/realtime-sdk/authentication#request-token), so this option is useful for library instances on auth servers where for some reason the server clock cannot be kept synchronized through normal means, such as an [NTP daemon](https://en.wikipedia.org/wiki/Ntpd). The server is queried for the current time once per client library instance (which stores the offset from the local clock), so if using this option you should avoid instancing a new version of the library for each request
**Default:** false | `Boolean` | | :default_token_params | When a [TokenParams](/docs/api/realtime-sdk/types#token-params) object is provided, it will override the client library defaults when issuing new Ably Tokens or Ably TokenRequests | [`TokenParams`](/docs/api/realtime-sdk/types#token-params) | | :disconnected_retry_timeout | When the connection enters the `DISCONNECTED` state, after this delay in seconds, if the state is still `DISCONNECTED`, the client library will attempt to reconnect automatically
**Default:** 15s | `Integer` | | :suspended_retry_timeout | When the connection enters the `SUSPENDED` state, after this delay in seconds, if the state is still `SUSPENDED`, the client library will attempt to reconnect automatically
**Default:** 30s | `Integer` | @@ -2058,17 +2058,17 @@ A `TokenRevocationFailureResult` contains information about the result of an uns | Property | Description | Type | |----------|-------------|------| -| key | The full key string, as obtained from the [application dashboard](https://ably.com/dashboard). Use this option if you wish to use Basic authentication, or wish to be able to issue Ably Tokens without needing to defer to a separate entity to sign Ably TokenRequests. Read more about [Basic authentication](/docs/auth/basic) | `String` | -| token | An authenticated [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) object, a [`TokenRequest`](/docs/api/realtime-sdk/types#token-request) object, or token string (obtained from the `token` property of a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) component of an Ably TokenRequest response, or a [JSON Web Token](https://tools.ietf.org/html/rfc7519) satisfying [the Ably requirements for JWTs](/docs/auth/token#jwt)). This option is mostly useful for testing: since tokens are short-lived, in production you almost always want to use an authentication method that allows the client library to renew the token automatically when the previous one expires, such as `authUrl` or `authCallback`. Read more about [Token authentication](/docs/auth/token) | `String`, `TokenDetails` or `TokenRequest` | -| authCallback | A function which is called when a new token is required. The role of the callback is to obtain a fresh token, one of: an Ably Token string (in plain text format); a signed [`TokenRequest`](/docs/api/realtime-sdk/types#token-request); a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) (in JSON format); an [Ably JWT](/docs/api/realtime-sdk/authentication#ably-jwt). See [our authentication documentation](/docs/auth) for details of the Ably TokenRequest format and associated API calls | `Callable` | +| key | The full key string, as obtained from the [application dashboard](https://ably.com/dashboard). Use this option if you wish to use Basic authentication, or wish to be able to issue Ably Tokens without needing to defer to a separate entity to sign Ably TokenRequests. Read more about [Basic authentication](/docs/platform/auth/basic) | `String` | +| token | An authenticated [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) object, a [`TokenRequest`](/docs/api/realtime-sdk/types#token-request) object, or token string (obtained from the `token` property of a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) component of an Ably TokenRequest response, or a [JSON Web Token](https://tools.ietf.org/html/rfc7519) satisfying [the Ably requirements for JWTs](/docs/platform/auth/token#jwt)). This option is mostly useful for testing: since tokens are short-lived, in production you almost always want to use an authentication method that allows the client library to renew the token automatically when the previous one expires, such as `authUrl` or `authCallback`. Read more about [Token authentication](/docs/platform/auth/token) | `String`, `TokenDetails` or `TokenRequest` | +| authCallback | A function which is called when a new token is required. The role of the callback is to obtain a fresh token, one of: an Ably Token string (in plain text format); a signed [`TokenRequest`](/docs/api/realtime-sdk/types#token-request); a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) (in JSON format); an [Ably JWT](/docs/api/realtime-sdk/authentication#ably-jwt). See [our authentication documentation](/docs/platform/auth) for details of the Ably TokenRequest format and associated API calls | `Callable` | | authUrl | A URL that the library may use to obtain a fresh token, one of: an Ably Token string (in plain text format); a signed [`TokenRequest`](/docs/api/realtime-sdk/types#token-request); a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) (in JSON format); an [Ably JWT](/docs/api/realtime-sdk/authentication#ably-jwt). For example, this can be used by a client to obtain signed Ably TokenRequests from an application server | `NSURL` | | authMethod | The HTTP verb to use for the request, either `GET` or `POST`
**Default:** `GET` | `String` | | authHeaders | A set of key value pair headers to be added to any request made to the `authUrl`. Useful when an application requires these to be added to validate the request or implement the response | `Object` | | authParams | A set of key value pair params to be added to any request made to the `authUrl`. When the `authMethod` is `GET`, query params are added to the URL, whereas when `authMethod` is `POST`, the params are sent as URL encoded form data. Useful when an application require these to be added to validate the request or implement the response | `[NSURLQueryItem]/Array` | -| tokenDetails | An authenticated [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) object (most commonly obtained from an Ably Token Request response). This option is mostly useful for testing: since tokens are short-lived, in production you almost always want to use an authentication method that allows the client library to renew the token automatically when the previous one expires, such as `authUrl` or `authCallback`. Use this option if you wish to use Token authentication. Read more about [Token authentication](/docs/auth/token) | `TokenDetails` | +| tokenDetails | An authenticated [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) object (most commonly obtained from an Ably Token Request response). This option is mostly useful for testing: since tokens are short-lived, in production you almost always want to use an authentication method that allows the client library to renew the token automatically when the previous one expires, such as `authUrl` or `authCallback`. Use this option if you wish to use Token authentication. Read more about [Token authentication](/docs/platform/auth/token) | `TokenDetails` | | tls | A boolean value, indicating whether or not a TLS ("SSL") secure connection should be used. An insecure connection cannot be used with Basic authentication as it would lead to a possible compromise of the private API key while in transit. [Find out more about TLS](https://faqs.ably.com/are-messages-sent-to-and-received-from-ably-securely-using-tls)
**Default:** true | `Boolean` | -| clientId | A client ID, used for identifying this client when publishing messages or for presence purposes. The `clientId` can be any non-empty string. This option is primarily intended to be used in situations where the library is instantiated with a key; note that a `clientId` may also be implicit in a token used to instantiate the library; an error will be raised if a `clientId` specified here conflicts with the `clientId` implicit in the token. [Find out more about client identities](/docs/auth/identified-clients) | `String` | -| useTokenAuth | When true, forces [Token authentication](/docs/auth/token) to be used by the library. Please note that if a `clientId` is not specified in the [`ClientOptions`](/docs/api/realtime-sdk/types#client-options) or [`TokenParams`](/docs/api/realtime-sdk/types#token-params), then the Ably Token issued will be [anonymous](https://faqs.ably.com/authenticated-and-identified-clients)
**Default:** false | `Boolean` | +| clientId | A client ID, used for identifying this client when publishing messages or for presence purposes. The `clientId` can be any non-empty string. This option is primarily intended to be used in situations where the library is instantiated with a key; note that a `clientId` may also be implicit in a token used to instantiate the library; an error will be raised if a `clientId` specified here conflicts with the `clientId` implicit in the token. [Find out more about client identities](/docs/platform/auth/identified-clients) | `String` | +| useTokenAuth | When true, forces [Token authentication](/docs/platform/auth/token) to be used by the library. Please note that if a `clientId` is not specified in the [`ClientOptions`](/docs/api/realtime-sdk/types#client-options) or [`TokenParams`](/docs/api/realtime-sdk/types#token-params), then the Ably Token issued will be [anonymous](https://faqs.ably.com/authenticated-and-identified-clients)
**Default:** false | `Boolean` | | endpoint | Enables [enterprise customers](https://ably.com/pricing) to use their own custom endpoints, which support dedicated, isolated clusters and regional message routing and storage constraints. See our [platform customization guide](/docs/platform/account/enterprise-customization) for more details
**Default:** nil | `String` | | environment | Deprecated, use `endpoint`. Enables [enterprise customers](https://ably.com/pricing) to use their own custom environments, which support dedicated, isolated clusters and regional message routing and storage constraints. See our [platform customization guide](/docs/platform/account/enterprise-customization) for more details
**Default:** nil | `String` | | idempotentRestPublishing | When true, enables idempotent publishing by assigning a unique message ID client-side, allowing the Ably servers to discard automatic publish retries following a failure such as a network fault. We recommend you enable this by default. In version 1.2 onwards, idempotent publishing for retries will be enabled by default
**Default:** false | `Boolean` | @@ -2082,7 +2082,7 @@ A `TokenRevocationFailureResult` contains information about the result of an uns | echoMessages | If false, prevents messages originating from this connection being echoed back on the same connection
**Default:** true | `Boolean` | | autoConnect | By default as soon as the client library is instantiated it will connect to Ably. You can optionally set this to false and explicitly connect to Ably when require using the [`connect`](/docs/api/realtime-sdk/connection#connect) method
**Default:** true | `Boolean` | | recover | This option allows a connection to inherit the state of a previous connection that may have existed under a different instance of the library by providing that connection's [`recoveryKey`](/docs/api/realtime-sdk/connection#recovery-key). This might typically be used by clients of an app to ensure connection state can be preserved following a reload. See [connection state recovery](/docs/connect/states) for further information and example code | `String` | -| queryTime | If true, the library will query the Ably servers for the current time when [issuing TokenRequests](/docs/auth/token) instead of relying on a locally-available time of day. Knowing the time accurately is needed to create valid signed Ably [TokenRequests](/docs/api/realtime-sdk/authentication#request-token), so this option is useful for library instances on auth servers where for some reason the server clock cannot be kept synchronized through normal means, such as an [NTP daemon](https://en.wikipedia.org/wiki/Ntpd). The server is queried for the current time once per client library instance (which stores the offset from the local clock), so if using this option you should avoid instancing a new version of the library for each request
**Default:** false | `Boolean` | +| queryTime | If true, the library will query the Ably servers for the current time when [issuing TokenRequests](/docs/platform/auth/token) instead of relying on a locally-available time of day. Knowing the time accurately is needed to create valid signed Ably [TokenRequests](/docs/api/realtime-sdk/authentication#request-token), so this option is useful for library instances on auth servers where for some reason the server clock cannot be kept synchronized through normal means, such as an [NTP daemon](https://en.wikipedia.org/wiki/Ntpd). The server is queried for the current time once per client library instance (which stores the offset from the local clock), so if using this option you should avoid instancing a new version of the library for each request
**Default:** false | `Boolean` | | defaultTokenParams | When a [TokenParams](/docs/api/realtime-sdk/types#token-params) object is provided, it will override the client library defaults when issuing new Ably Tokens or Ably TokenRequests | [`TokenParams`](/docs/api/realtime-sdk/types#token-params) | | disconnectedRetryTimeout | When the connection enters the `DISCONNECTED` state, after this delay as a `NSTimeInterval`, if the state is still `DISCONNECTED`, the client library will attempt to reconnect automatically
**Default:** 15,000ms | `NSTimeInterval` | | suspendedRetryTimeout | When the connection enters the `SUSPENDED` state, after this delay as a `NSTimeInterval`, if the state is still `SUSPENDED`, the client library will attempt to reconnect automatically
**Default:** 30,000ms | `NSTimeInterval` | @@ -2093,17 +2093,17 @@ A `TokenRevocationFailureResult` contains information about the result of an uns | Property | Description | Type | |----------|-------------|------| -| key | The full key string, as obtained from the [application dashboard](https://ably.com/dashboard). Use this option if you wish to use Basic authentication, or wish to be able to issue Ably Tokens without needing to defer to a separate entity to sign Ably TokenRequests. Read more about [Basic authentication](/docs/auth/basic) | `String` | -| token | An authenticated [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) object, a [`TokenRequest`](/docs/api/realtime-sdk/types#token-request) object, or token string (obtained from the `token` property of a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) component of an Ably TokenRequest response, or a [JSON Web Token](https://tools.ietf.org/html/rfc7519) satisfying [the Ably requirements for JWTs](/docs/auth/token#jwt)). This option is mostly useful for testing: since tokens are short-lived, in production you almost always want to use an authentication method that allows the client library to renew the token automatically when the previous one expires, such as `authUrl` or `authCallback`. Read more about [Token authentication](/docs/auth/token) | `String`, `TokenDetails` or `TokenRequest` | -| authCallback | A function which is called when a new token is required. The role of the callback is to obtain a fresh token, one of: an Ably Token string (in plain text format); a signed [`TokenRequest`](/docs/api/realtime-sdk/types#token-request); a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) (in JSON format); an [Ably JWT](/docs/api/realtime-sdk/authentication#ably-jwt). See [our authentication documentation](/docs/auth) for details of the Ably TokenRequest format and associated API calls | `Callable` | +| key | The full key string, as obtained from the [application dashboard](https://ably.com/dashboard). Use this option if you wish to use Basic authentication, or wish to be able to issue Ably Tokens without needing to defer to a separate entity to sign Ably TokenRequests. Read more about [Basic authentication](/docs/platform/auth/basic) | `String` | +| token | An authenticated [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) object, a [`TokenRequest`](/docs/api/realtime-sdk/types#token-request) object, or token string (obtained from the `token` property of a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) component of an Ably TokenRequest response, or a [JSON Web Token](https://tools.ietf.org/html/rfc7519) satisfying [the Ably requirements for JWTs](/docs/platform/auth/token#jwt)). This option is mostly useful for testing: since tokens are short-lived, in production you almost always want to use an authentication method that allows the client library to renew the token automatically when the previous one expires, such as `authUrl` or `authCallback`. Read more about [Token authentication](/docs/platform/auth/token) | `String`, `TokenDetails` or `TokenRequest` | +| authCallback | A function which is called when a new token is required. The role of the callback is to obtain a fresh token, one of: an Ably Token string (in plain text format); a signed [`TokenRequest`](/docs/api/realtime-sdk/types#token-request); a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) (in JSON format); an [Ably JWT](/docs/api/realtime-sdk/authentication#ably-jwt). See [our authentication documentation](/docs/platform/auth) for details of the Ably TokenRequest format and associated API calls | `Callable` | | authUrl | A URL that the library may use to obtain a fresh token, one of: an Ably Token string (in plain text format); a signed [`TokenRequest`](/docs/api/realtime-sdk/types#token-request); a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) (in JSON format); an [Ably JWT](/docs/api/realtime-sdk/authentication#ably-jwt). For example, this can be used by a client to obtain signed Ably TokenRequests from an application server | `String` | | authMethod | The HTTP verb to use for the request, either `GET` or `POST`
**Default:** `GET` | `String` | | authHeaders | A set of key value pair headers to be added to any request made to the `authUrl`. Useful when an application requires these to be added to validate the request or implement the response | `Map` | | authParams | A set of key value pair params to be added to any request made to the `authUrl`. When the `authMethod` is `GET`, query params are added to the URL, whereas when `authMethod` is `POST`, the params are sent as URL encoded form data. Useful when an application require these to be added to validate the request or implement the response | `Map` | -| tokenDetails | An authenticated [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) object (most commonly obtained from an Ably Token Request response). This option is mostly useful for testing: since tokens are short-lived, in production you almost always want to use an authentication method that allows the client library to renew the token automatically when the previous one expires, such as `authUrl` or `authCallback`. Use this option if you wish to use Token authentication. Read more about [Token authentication](/docs/auth/token) | `TokenDetails` | +| tokenDetails | An authenticated [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) object (most commonly obtained from an Ably Token Request response). This option is mostly useful for testing: since tokens are short-lived, in production you almost always want to use an authentication method that allows the client library to renew the token automatically when the previous one expires, such as `authUrl` or `authCallback`. Use this option if you wish to use Token authentication. Read more about [Token authentication](/docs/platform/auth/token) | `TokenDetails` | | tls | A boolean value, indicating whether or not a TLS ("SSL") secure connection should be used. An insecure connection cannot be used with Basic authentication as it would lead to a possible compromise of the private API key while in transit. [Find out more about TLS](https://faqs.ably.com/are-messages-sent-to-and-received-from-ably-securely-using-tls)
**Default:** true | `Boolean` | -| clientId | A client ID, used for identifying this client when publishing messages or for presence purposes. The `clientId` can be any non-empty string. This option is primarily intended to be used in situations where the library is instantiated with a key; note that a `clientId` may also be implicit in a token used to instantiate the library; an error will be raised if a `clientId` specified here conflicts with the `clientId` implicit in the token. [Find out more about client identities](/docs/auth/identified-clients) | `String` | -| useTokenAuth | When true, forces [Token authentication](/docs/auth/token) to be used by the library. Please note that if a `clientId` is not specified in the [`ClientOptions`](/docs/api/realtime-sdk/types#client-options) or [`TokenParams`](/docs/api/realtime-sdk/types#token-params), then the Ably Token issued will be [anonymous](https://faqs.ably.com/authenticated-and-identified-clients)
**Default:** false | `Boolean` | +| clientId | A client ID, used for identifying this client when publishing messages or for presence purposes. The `clientId` can be any non-empty string. This option is primarily intended to be used in situations where the library is instantiated with a key; note that a `clientId` may also be implicit in a token used to instantiate the library; an error will be raised if a `clientId` specified here conflicts with the `clientId` implicit in the token. [Find out more about client identities](/docs/platform/auth/identified-clients) | `String` | +| useTokenAuth | When true, forces [Token authentication](/docs/platform/auth/token) to be used by the library. Please note that if a `clientId` is not specified in the [`ClientOptions`](/docs/api/realtime-sdk/types#client-options) or [`TokenParams`](/docs/api/realtime-sdk/types#token-params), then the Ably Token issued will be [anonymous](https://faqs.ably.com/authenticated-and-identified-clients)
**Default:** false | `Boolean` | | endpoint | Enables [enterprise customers](https://ably.com/pricing) to use their own custom endpoints, which support dedicated, isolated clusters and regional message routing and storage constraints. See our [platform customization guide](/docs/platform/account/enterprise-customization) for more details
**Default:** null | `String` | | environment | Deprecated, use `endpoint`. Enables [enterprise customers](https://ably.com/pricing) to use their own custom environments, which support dedicated, isolated clusters and regional message routing and storage constraints. See our [platform customization guide](/docs/platform/account/enterprise-customization) for more details
**Default:** null | `String` | | idempotentRestPublishing | When true, enables idempotent publishing by assigning a unique message ID client-side, allowing the Ably servers to discard automatic publish retries following a failure such as a network fault. We recommend you enable this by default. In version 1.2 onwards, idempotent publishing for retries will be enabled by default
**Default:** false | `Boolean` | @@ -2113,7 +2113,7 @@ A `TokenRevocationFailureResult` contains information about the result of an uns | queueMessages | If false, this disables the default behavior whereby the library queues messages on a connection in the disconnected or connecting states. The default behavior allows applications to submit messages immediately upon instancing the library without having to wait for the connection to be established. Applications may use this option to disable queueing if they wish to have application-level control over the queueing under those conditions
**Default:** true | `Boolean` | | echoMessages | If false, prevents messages originating from this connection being echoed back on the same connection
**Default:** true | `Boolean` | | autoConnect | By default as soon as the client library is instantiated it will connect to Ably. You can optionally set this to false and explicitly connect to Ably when require using the [`connect`](/docs/api/realtime-sdk/connection#connect) method
**Default:** true | `Boolean` | -| queryTime | If true, the library will query the Ably servers for the current time when [issuing TokenRequests](/docs/auth/token) instead of relying on a locally-available time of day. Knowing the time accurately is needed to create valid signed Ably [TokenRequests](/docs/api/realtime-sdk/authentication#request-token), so this option is useful for library instances on auth servers where for some reason the server clock cannot be kept synchronized through normal means, such as an [NTP daemon](https://en.wikipedia.org/wiki/Ntpd). The server is queried for the current time once per client library instance (which stores the offset from the local clock), so if using this option you should avoid instancing a new version of the library for each request
**Default:** false | `Boolean` | +| queryTime | If true, the library will query the Ably servers for the current time when [issuing TokenRequests](/docs/platform/auth/token) instead of relying on a locally-available time of day. Knowing the time accurately is needed to create valid signed Ably [TokenRequests](/docs/api/realtime-sdk/authentication#request-token), so this option is useful for library instances on auth servers where for some reason the server clock cannot be kept synchronized through normal means, such as an [NTP daemon](https://en.wikipedia.org/wiki/Ntpd). The server is queried for the current time once per client library instance (which stores the offset from the local clock), so if using this option you should avoid instancing a new version of the library for each request
**Default:** false | `Boolean` | | defaultTokenParams | When a [TokenParams](/docs/api/realtime-sdk/types#token-params) object is provided, it will override the client library defaults when issuing new Ably Tokens or Ably TokenRequests | [`TokenParams`](/docs/api/realtime-sdk/types#token-params) | | disconnectedRetryTimeout | When the connection enters the `DISCONNECTED` state, after this delay in milliseconds, if the state is still `DISCONNECTED`, the client library will attempt to reconnect automatically
**Default:** 15,000ms | `Integer` | | suspendedRetryTimeout | When the connection enters the `SUSPENDED` state, after this delay in milliseconds, if the state is still `SUSPENDED`, the client library will attempt to reconnect automatically
**Default:** 30,000ms | `Integer` | @@ -2124,17 +2124,17 @@ A `TokenRevocationFailureResult` contains information about the result of an uns | Property | Description | Type | |----------|-------------|------| -| Key | The full key string, as obtained from the [application dashboard](https://ably.com/dashboard). Use this option if you wish to use Basic authentication, or wish to be able to issue Ably Tokens without needing to defer to a separate entity to sign Ably TokenRequests. Read more about [Basic authentication](/docs/auth/basic) | `String` | -| Token | An authenticated [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) object, a [`TokenRequest`](/docs/api/realtime-sdk/types#token-request) object, or token string (obtained from the `token` property of a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) component of an Ably TokenRequest response, or a [JSON Web Token](https://tools.ietf.org/html/rfc7519) satisfying [the Ably requirements for JWTs](/docs/auth/token#jwt)). This option is mostly useful for testing: since tokens are short-lived, in production you almost always want to use an authentication method that allows the client library to renew the token automatically when the previous one expires, such as `authUrl` or `authCallback`. Read more about [Token authentication](/docs/auth/token) | `String`, `TokenDetails` or `TokenRequest` | -| AuthCallback | A function which is called when a new token is required. The role of the callback is to obtain a fresh token, one of: an Ably Token string (in plain text format); a signed [`TokenRequest`](/docs/api/realtime-sdk/types#token-request); a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) (in JSON format); an [Ably JWT](/docs/api/realtime-sdk/authentication#ably-jwt). See [our authentication documentation](/docs/auth) for details of the Ably TokenRequest format and associated API calls | `Callable` | +| Key | The full key string, as obtained from the [application dashboard](https://ably.com/dashboard). Use this option if you wish to use Basic authentication, or wish to be able to issue Ably Tokens without needing to defer to a separate entity to sign Ably TokenRequests. Read more about [Basic authentication](/docs/platform/auth/basic) | `String` | +| Token | An authenticated [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) object, a [`TokenRequest`](/docs/api/realtime-sdk/types#token-request) object, or token string (obtained from the `token` property of a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) component of an Ably TokenRequest response, or a [JSON Web Token](https://tools.ietf.org/html/rfc7519) satisfying [the Ably requirements for JWTs](/docs/platform/auth/token#jwt)). This option is mostly useful for testing: since tokens are short-lived, in production you almost always want to use an authentication method that allows the client library to renew the token automatically when the previous one expires, such as `authUrl` or `authCallback`. Read more about [Token authentication](/docs/platform/auth/token) | `String`, `TokenDetails` or `TokenRequest` | +| AuthCallback | A function which is called when a new token is required. The role of the callback is to obtain a fresh token, one of: an Ably Token string (in plain text format); a signed [`TokenRequest`](/docs/api/realtime-sdk/types#token-request); a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) (in JSON format); an [Ably JWT](/docs/api/realtime-sdk/authentication#ably-jwt). See [our authentication documentation](/docs/platform/auth) for details of the Ably TokenRequest format and associated API calls | `Callable` | | AuthUrl | A URL that the library may use to obtain a fresh token, one of: an Ably Token string (in plain text format); a signed [`TokenRequest`](/docs/api/realtime-sdk/types#token-request); a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) (in JSON format); an [Ably JWT](/docs/api/realtime-sdk/authentication#ably-jwt). For example, this can be used by a client to obtain signed Ably TokenRequests from an application server | `String` | | AuthMethod | The HTTP verb to use for the request, either `GET` or `POST`
**Default:** `GET` | `String` | | AuthHeaders | A set of key value pair headers to be added to any request made to the `authUrl`. Useful when an application requires these to be added to validate the request or implement the response | `Map` | | AuthParams | A set of key value pair params to be added to any request made to the `authUrl`. When the `authMethod` is `GET`, query params are added to the URL, whereas when `authMethod` is `POST`, the params are sent as URL encoded form data. Useful when an application require these to be added to validate the request or implement the response | `Map` | -| TokenDetails | An authenticated [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) object (most commonly obtained from an Ably Token Request response). This option is mostly useful for testing: since tokens are short-lived, in production you almost always want to use an authentication method that allows the client library to renew the token automatically when the previous one expires, such as `authUrl` or `authCallback`. Use this option if you wish to use Token authentication. Read more about [Token authentication](/docs/auth/token) | `TokenDetails` | +| TokenDetails | An authenticated [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) object (most commonly obtained from an Ably Token Request response). This option is mostly useful for testing: since tokens are short-lived, in production you almost always want to use an authentication method that allows the client library to renew the token automatically when the previous one expires, such as `authUrl` or `authCallback`. Use this option if you wish to use Token authentication. Read more about [Token authentication](/docs/platform/auth/token) | `TokenDetails` | | Tls | A boolean value, indicating whether or not a TLS ("SSL") secure connection should be used. An insecure connection cannot be used with Basic authentication as it would lead to a possible compromise of the private API key while in transit. [Find out more about TLS](https://faqs.ably.com/are-messages-sent-to-and-received-from-ably-securely-using-tls)
**Default:** true | `Boolean` | -| ClientId | A client ID, used for identifying this client when publishing messages or for presence purposes. The `clientId` can be any non-empty string. This option is primarily intended to be used in situations where the library is instantiated with a key; note that a `clientId` may also be implicit in a token used to instantiate the library; an error will be raised if a `clientId` specified here conflicts with the `clientId` implicit in the token. [Find out more about client identities](/docs/auth/identified-clients) | `String` | -| UseTokenAuth | When true, forces [Token authentication](/docs/auth/token) to be used by the library. Please note that if a `clientId` is not specified in the [`ClientOptions`](/docs/api/realtime-sdk/types#client-options) or [`TokenParams`](/docs/api/realtime-sdk/types#token-params), then the Ably Token issued will be [anonymous](https://faqs.ably.com/authenticated-and-identified-clients)
**Default:** false | `Boolean` | +| ClientId | A client ID, used for identifying this client when publishing messages or for presence purposes. The `clientId` can be any non-empty string. This option is primarily intended to be used in situations where the library is instantiated with a key; note that a `clientId` may also be implicit in a token used to instantiate the library; an error will be raised if a `clientId` specified here conflicts with the `clientId` implicit in the token. [Find out more about client identities](/docs/platform/auth/identified-clients) | `String` | +| UseTokenAuth | When true, forces [Token authentication](/docs/platform/auth/token) to be used by the library. Please note that if a `clientId` is not specified in the [`ClientOptions`](/docs/api/realtime-sdk/types#client-options) or [`TokenParams`](/docs/api/realtime-sdk/types#token-params), then the Ably Token issued will be [anonymous](https://faqs.ably.com/authenticated-and-identified-clients)
**Default:** false | `Boolean` | | Endpoint | Enables [enterprise customers](https://ably.com/pricing) to use their own custom endpoints, which support dedicated, isolated clusters and regional message routing and storage constraints. See our [platform customization guide](/docs/platform/account/enterprise-customization) for more details
**Default:** null | `String` | | Environment | Deprecated, use `endpoint`. Enables [enterprise customers](https://ably.com/pricing) to use their own custom environments, which support dedicated, isolated clusters and regional message routing and storage constraints. See our [platform customization guide](/docs/platform/account/enterprise-customization) for more details
**Default:** null | `String` | | IdempotentRestPublishing | When true, enables idempotent publishing by assigning a unique message ID client-side, allowing the Ably servers to discard automatic publish retries following a failure such as a network fault. We recommend you enable this by default. In version 1.2 onwards, idempotent publishing for retries will be enabled by default
**Default:** false | `Boolean` | @@ -2144,7 +2144,7 @@ A `TokenRevocationFailureResult` contains information about the result of an uns | QueueMessages | If false, this disables the default behavior whereby the library queues messages on a connection in the disconnected or connecting states. The default behavior allows applications to submit messages immediately upon instancing the library without having to wait for the connection to be established. Applications may use this option to disable queueing if they wish to have application-level control over the queueing under those conditions
**Default:** true | `Boolean` | | EchoMessages | If false, prevents messages originating from this connection being echoed back on the same connection
**Default:** true | `Boolean` | | AutoConnect | By default as soon as the client library is instantiated it will connect to Ably. You can optionally set this to false and explicitly connect to Ably when require using the [`connect`](/docs/api/realtime-sdk/connection#connect) method
**Default:** true | `Boolean` | -| QueryTime | If true, the library will query the Ably servers for the current time when [issuing TokenRequests](/docs/auth/token) instead of relying on a locally-available time of day. Knowing the time accurately is needed to create valid signed Ably [TokenRequests](/docs/api/realtime-sdk/authentication#request-token), so this option is useful for library instances on auth servers where for some reason the server clock cannot be kept synchronized through normal means, such as an [NTP daemon](https://en.wikipedia.org/wiki/Ntpd). The server is queried for the current time once per client library instance (which stores the offset from the local clock), so if using this option you should avoid instancing a new version of the library for each request
**Default:** false | `Boolean` | +| QueryTime | If true, the library will query the Ably servers for the current time when [issuing TokenRequests](/docs/platform/auth/token) instead of relying on a locally-available time of day. Knowing the time accurately is needed to create valid signed Ably [TokenRequests](/docs/api/realtime-sdk/authentication#request-token), so this option is useful for library instances on auth servers where for some reason the server clock cannot be kept synchronized through normal means, such as an [NTP daemon](https://en.wikipedia.org/wiki/Ntpd). The server is queried for the current time once per client library instance (which stores the offset from the local clock), so if using this option you should avoid instancing a new version of the library for each request
**Default:** false | `Boolean` | | DefaultTokenParams | When a [TokenParams](/docs/api/realtime-sdk/types#token-params) object is provided, it will override the client library defaults when issuing new Ably Tokens or Ably TokenRequests | [`TokenParams`](/docs/api/realtime-sdk/types#token-params) | | DisconnectedRetryTimeout | When the connection enters the `DISCONNECTED` state, after this delay in milliseconds, if the state is still `DISCONNECTED`, the client library will attempt to reconnect automatically
**Default:** 15,000ms | `Integer` | | SuspendedRetryTimeout | When the connection enters the `SUSPENDED` state, after this delay in milliseconds, if the state is still `SUSPENDED`, the client library will attempt to reconnect automatically
**Default:** 30,000ms | `Integer` | @@ -3283,25 +3283,25 @@ Mark the `Deferrable` as succeeded and trigger all callbacks. See the [EventMach -`TokenParams` is a plain JavaScript object and is used in the parameters of [token authentication](/docs/auth/token) requests, corresponding to the desired attributes of the [Ably Token](/docs/api/realtime-sdk/authentication#token-details). The following attributes can be defined on the object: +`TokenParams` is a plain JavaScript object and is used in the parameters of [token authentication](/docs/platform/auth/token) requests, corresponding to the desired attributes of the [Ably Token](/docs/api/realtime-sdk/authentication#token-details). The following attributes can be defined on the object: -`TokenParams` is a Hash object and is used in the parameters of [token authentication](/docs/auth/token) requests, corresponding to the desired attributes of the [Ably Token](/docs/api/realtime-sdk/authentication#token-details). The following key symbol values can be added to the Hash: +`TokenParams` is a Hash object and is used in the parameters of [token authentication](/docs/platform/auth/token) requests, corresponding to the desired attributes of the [Ably Token](/docs/api/realtime-sdk/authentication#token-details). The following key symbol values can be added to the Hash: -`TokenParams` is used in the parameters of [token authentication](/docs/auth/token) requests, corresponding to the desired attributes of the [Ably Token](/docs/api/realtime-sdk/authentication#token-details). +`TokenParams` is used in the parameters of [token authentication](/docs/platform/auth/token) requests, corresponding to the desired attributes of the [Ably Token](/docs/api/realtime-sdk/authentication#token-details). -`ARTTokenParams` is used in the parameters of [token authentication](/docs/auth/token) requests, corresponding to the desired attributes of the [Ably Token](/docs/api/realtime-sdk/authentication#token-details). +`ARTTokenParams` is used in the parameters of [token authentication](/docs/platform/auth/token) requests, corresponding to the desired attributes of the [Ably Token](/docs/api/realtime-sdk/authentication#token-details). @@ -3309,8 +3309,8 @@ Mark the `Deferrable` as succeeded and trigger all callbacks. See the [EventMach | Property | Description | Type | |----------|-------------|------| -| capabilityCapability:capability | JSON stringified capability of the [Ably Token](/docs/api/realtime-sdk/authentication#token-details). If the [Ably Token](/docs/api/realtime-sdk/authentication#token-details) request is successful, the capability of the returned [Ably Token](/docs/api/realtime-sdk/authentication#token-details) will be the intersection of this capability with the capability of the issuing key. [Find our more about how to use capabilities to manage access privileges for clients](/docs/auth/capabilities). | `String``Capability` | -| clientIdClientId:client_id | A client ID, used for identifying this client when publishing messages or for presence purposes. The `clientId``:client_id``ClientId` can be any non-empty string. This option is primarily intended to be used in situations where the library is instantiated with a key; note that a `clientId``:client_id``ClientId` may also be implicit in a token used to instantiate the library; an error will be raised if a `clientId``:client_id``ClientId` specified here conflicts with the `clientId``:client_id``ClientId` implicit in the token. [Find out more about client identities](/docs/auth/identified-clients) | `String` | +| capabilityCapability:capability | JSON stringified capability of the [Ably Token](/docs/api/realtime-sdk/authentication#token-details). If the [Ably Token](/docs/api/realtime-sdk/authentication#token-details) request is successful, the capability of the returned [Ably Token](/docs/api/realtime-sdk/authentication#token-details) will be the intersection of this capability with the capability of the issuing key. [Find our more about how to use capabilities to manage access privileges for clients](/docs/platform/auth/capabilities). | `String``Capability` | +| clientIdClientId:client_id | A client ID, used for identifying this client when publishing messages or for presence purposes. The `clientId``:client_id``ClientId` can be any non-empty string. This option is primarily intended to be used in situations where the library is instantiated with a key; note that a `clientId``:client_id``ClientId` may also be implicit in a token used to instantiate the library; an error will be raised if a `clientId``:client_id``ClientId` specified here conflicts with the `clientId``:client_id``ClientId` implicit in the token. [Find out more about client identities](/docs/platform/auth/identified-clients) | `String` | | nonceNonce:nonce | An optional opaque nonce string of at least 16 characters to ensure uniqueness of this request. Any subsequent request using the same nonce will be rejected. | `String` | | timestampTimestamp:timestamp | The timestamp (in milliseconds since the epoch)The timestamp of this request. `timestamp`, in conjunction with the `nonce`, is used to prevent requests for [Ably Token](/docs/api/realtime-sdk/authentication#token-details) from being replayed. | `Integer``Long Integer``Time``NSDate``DateTimeOffset` | | ttlTtl:ttl | _1 hour_ Requested time to live for the [Ably Token](/docs/api/realtime-sdk/authentication#token-details) being created in millisecondsin secondsas a `NSTimeInterval`as a `TimeSpan`. When omitted, the Ably REST API default of 60 minutes is applied by Ably | `Integer` (milliseconds)`Integer` (seconds)`NSTimeInterval``Long Integer``TimeSpan` | diff --git a/src/pages/docs/api/rest-api.mdx b/src/pages/docs/api/rest-api.mdx index 269187edbd..203d593344 100644 --- a/src/pages/docs/api/rest-api.mdx +++ b/src/pages/docs/api/rest-api.mdx @@ -295,7 +295,7 @@ Envelope responses always are always made with a 200 status code; the status of ## Authentication
-To understand the REST API it is easiest first to understand the various authentication methods that Ably supports. For a detailed explanation, view the [Authentication documentation](/docs/auth). +To understand the REST API it is easiest first to understand the various authentication methods that Ably supports. For a detailed explanation, view the [Authentication documentation](/docs/platform/auth). Clients can access Ably, whether using REST or the Realtime service, by two methods: @@ -343,7 +343,7 @@ curl https://main.realtime.ably.net/channels/rest-example/messages \ ### Token Authentication -**Token Authentication** uses an Ably-compatible token to authenticate with Ably without sharing a private API key. This can be an [Ably Token](/docs/api/rest-sdk/authentication#tokens) obtained via the REST API [`requestToken`](#request-token) endpoint, an [Ably JWT](/docs/api/rest-sdk/authentication#ably-jwt) signed by your API key, or an [External JWT](https://jwt.io) object [with an embedded Ably-compatible token](/docs/auth/token#embedded). Tokens are authentication credentials that are short-lived, and therefore they may more readily be distributed to clients where there is a risk of compromise. Tokens may also be issued with a particular scope - such as a limited set of [access rights or capabilities](/docs/auth/capabilities) or being limited to use by a specific [`clientId` identity](#identified-clients) - and therefore token-based authentication provides the flexibility to implement access and identity control policies in the application. See the [Token Authentication documentation](/docs/auth/token) for more details. +**Token Authentication** uses an Ably-compatible token to authenticate with Ably without sharing a private API key. This can be an [Ably Token](/docs/api/rest-sdk/authentication#tokens) obtained via the REST API [`requestToken`](#request-token) endpoint, an [Ably JWT](/docs/api/rest-sdk/authentication#ably-jwt) signed by your API key, or an [External JWT](https://jwt.io) object [with an embedded Ably-compatible token](/docs/platform/auth/token#embedded). Tokens are authentication credentials that are short-lived, and therefore they may more readily be distributed to clients where there is a risk of compromise. Tokens may also be issued with a particular scope - such as a limited set of [access rights or capabilities](/docs/platform/auth/capabilities) or being limited to use by a specific [`clientId` identity](#identified-clients) - and therefore token-based authentication provides the flexibility to implement access and identity control policies in the application. See the [Token Authentication documentation](/docs/platform/auth/token) for more details. The construction of an Ably [`TokenRequest`](/docs/api/token-request-spec) is described in the [Authentication Ably TokenRequest spec documentation](/docs/api/token-request-spec). The resulting `token response` object contains the token properties as defined in [Ably TokenRequest spec](/docs/api/token-request-spec). @@ -1681,7 +1681,7 @@ A successful request returns a [paginated response](#pagination) of: ### Publish directly to specific recipients -Convenience endpoint to deliver a push notification payload to a single device or set of devices identified by their [client identifier](/docs/auth/identified-clients). +Convenience endpoint to deliver a push notification payload to a single device or set of devices identified by their [client identifier](/docs/platform/auth/identified-clients). If you want to send a push notification to subscribed clients without knowing about recipient devices' details, we recommend you look at [registering devices for push](#post-device-registration), then [subscribe them to channels](#post-channel-subscription), and then [send messages to the channels with push payloads](#message-extras-push). @@ -1943,7 +1943,7 @@ The request body has the following properties: | Property | Description | |----------|-------------| -| targets | An array of [target specifier](/docs/auth/revocation#target-specifiers) strings. | +| targets | An array of [target specifier](/docs/platform/auth/revocation#target-specifiers) strings. | | issuedBefore | Optional number (Unix timestamp in milliseconds); if not specified it is set to the current time. The token revocation only applies to tokens issued before this timestamp. A request with an `issuedBefore` in the future, or more than an hour in the past will be rejected. | | allowReauthMargin | The `allowReauthMargin` bool permits a token renewal cycle to take place without needing established connections to be dropped, by postponing enforcement to 30 seconds in the future, and sending any existing connections a hint to obtain (and upgrade the connection to use) a new token. It defaults to `false`, meaning that the effect is near-immediate. | @@ -1974,7 +1974,7 @@ The response is comparable to that of [Batch publish](#batch). If some tokens ca ##### See also -See the [token revocation documentation](/docs/auth/revocation) for further details. +See the [token revocation documentation](/docs/platform/auth/revocation) for further details. ## Application routes @@ -2027,7 +2027,7 @@ Stats records contain a hierarchy of elements relating to messages, connections Ably's message statistics categorize unsuccessful message delivery into two distinct types: refused and failed messages. -**Refused messages** are actively rejected by Ably's system. The most common cause is breaching a [rate limit](/docs/platform/pricing/limits), though refusals can also occur due to malformed message structure, insufficient [channel permissions](/docs/auth/capabilities), or other request defects. +**Refused messages** are actively rejected by Ably's system. The most common cause is breaching a [rate limit](/docs/platform/pricing/limits), though refusals can also occur due to malformed message structure, insufficient [channel permissions](/docs/platform/auth/capabilities), or other request defects. **Failed messages** represent delivery attempts that were unsuccessful for reasons other than active rejection by Ably. This category includes internal service issues and rejections from external systems. In the case of [Integrations](/docs/platform/integrations) or [Push Notifications](/docs/push), when an external target rejects a message, it appears in statistics as a failed message. diff --git a/src/pages/docs/api/rest-sdk.mdx b/src/pages/docs/api/rest-sdk.mdx index 0967d0235c..fafc69fafc 100644 --- a/src/pages/docs/api/rest-sdk.mdx +++ b/src/pages/docs/api/rest-sdk.mdx @@ -10,7 +10,7 @@ redirect_from: ## Constructor -The Ably REST library constructor is overloaded allowing it to be instantiated using a [`ClientOptions`](#client-options) object, or more simply using a string containing an [API key](/docs/auth/basic) or [Token](/docs/auth/token). +The Ably REST library constructor is overloaded allowing it to be instantiated using a [`ClientOptions`](#client-options) object, or more simply using a string containing an [API key](/docs/platform/auth/basic) or [Token](/docs/platform/auth/token). @@ -153,11 +153,11 @@ The REST constructor is used to instantiate the library. The REST library may be ### Authentication -The REST library needs to have credentials to be able to authenticate with the Ably service. Ably supports both Basic and Token based authentication schemes. Read more on [authentication](/docs/auth). +The REST library needs to have credentials to be able to authenticate with the Ably service. Ably supports both Basic and Token based authentication schemes. Read more on [authentication](/docs/platform/auth). #### Basic Authentication -A private API key string for [`ClientOptions#key`](#client-options)[`ClientOptions#Key`](#client-options) or the constructor, as obtained from the [application dashboard](https://ably.com/dashboard), is required for [Basic Authentication](/docs/auth/basic). Use this option if you wish to use [Basic authentication](/docs/auth/basic), or if you want to be able to [request Ably Tokens](/docs/auth/token) without needing to defer to a separate entity to sign Ably TokenRequests. Note that initializing the library with a `key``Key` does not necessarily mean that the library will use Basic auth; using the private key it is also able to create and sign Ably TokenRequests and use token authentication when necessary. +A private API key string for [`ClientOptions#key`](#client-options)[`ClientOptions#Key`](#client-options) or the constructor, as obtained from the [application dashboard](https://ably.com/dashboard), is required for [Basic Authentication](/docs/platform/auth/basic). Use this option if you wish to use [Basic authentication](/docs/platform/auth/basic), or if you want to be able to [request Ably Tokens](/docs/platform/auth/token) without needing to defer to a separate entity to sign Ably TokenRequests. Note that initializing the library with a `key``Key` does not necessarily mean that the library will use Basic auth; using the private key it is also able to create and sign Ably TokenRequests and use token authentication when necessary. #### Token Authentication @@ -165,7 +165,7 @@ The [`Clien Since tokens are short-lived, it is rarely sufficient to start with a token without the means for refreshing it. The [`authUrl` and `authCallback` options](#client-options)[`:auth_url` and `:auth_callback` options](#client-options)[`auth_url` and `auth_callback` options](#client-options)[`AuthUrl` and `AuthCallback` options](#client-options) are provided to allow a user of the library to provide new Ably-compatible tokens or Ably TokenRequests to the library as required; using these options allows the library to be instantiated without a `key` or `token``Key` or `Token`, and an initial token will be obtained automatically when required. -Read more on [authentication](/docs/auth). +Read more on [authentication](/docs/platform/auth). @@ -686,17 +686,17 @@ Returns a promise. On success, the promise is fulfilled with a [`BatchResult`](# | Parameter | Description | Type | |-----------|-------------|------| -| keyKey:key | The full key string, as obtained from the [application dashboard](https://ably.com/dashboard). Use this option if you wish to use Basic authentication, or wish to be able to issue Ably Tokens without needing to defer to a separate entity to sign Ably TokenRequests. Read more about [Basic authentication](/docs/auth/basic) | `String` | -| tokenToken:token | An authenticated token. This can either be a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) object, a [`TokenRequest`](/docs/api/realtime-sdk/types#token-request) object, or token string (obtained from the `token``Token` property of a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) component of an Ably TokenRequest response, or a [JSON Web Token](https://tools.ietf.org/html/rfc7519) satisfying [the Ably requirements for JWTs](/docs/auth/token#jwt)). This option is mostly useful for testing: since tokens are short-lived, in production you almost always want to use an authentication method that allows the client library to renew the token automatically when the previous one expires, such as `authUrl`:auth_urlauth_url or `authCallback``AuthCallback``auth_callback``:auth_callback`. Read more about [Token authentication](/docs/auth/token) | `String`, `TokenDetails` or `TokenRequest` | -| authCallbackAuthCallbackauth_callback:auth_callback | A functionfunction with the form `function(tokenParams, callback(err, tokenOrTokenRequest))``TokenCallback` instancecallable (eg a lambda)proc / lambda (called synchronously in REST and Realtime but does not block EventMachine in the latter) which is called when a new token is required. The role of the callback is to obtain a fresh token, one of: an Ably Token string (in plain text format); a signed [`TokenRequest`](/docs/api/realtime-sdk/types#token-request); a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) (in JSON format); an [Ably JWT](/docs/api/realtime-sdk/authentication#ably-jwt). See [our authentication documentation](/docs/auth) for details of the Ably TokenRequest format and associated API calls. | `Callable``TokenCallback``Proc` | +| keyKey:key | The full key string, as obtained from the [application dashboard](https://ably.com/dashboard). Use this option if you wish to use Basic authentication, or wish to be able to issue Ably Tokens without needing to defer to a separate entity to sign Ably TokenRequests. Read more about [Basic authentication](/docs/platform/auth/basic) | `String` | +| tokenToken:token | An authenticated token. This can either be a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) object, a [`TokenRequest`](/docs/api/realtime-sdk/types#token-request) object, or token string (obtained from the `token``Token` property of a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) component of an Ably TokenRequest response, or a [JSON Web Token](https://tools.ietf.org/html/rfc7519) satisfying [the Ably requirements for JWTs](/docs/platform/auth/token#jwt)). This option is mostly useful for testing: since tokens are short-lived, in production you almost always want to use an authentication method that allows the client library to renew the token automatically when the previous one expires, such as `authUrl`:auth_urlauth_url or `authCallback``AuthCallback``auth_callback``:auth_callback`. Read more about [Token authentication](/docs/platform/auth/token) | `String`, `TokenDetails` or `TokenRequest` | +| authCallbackAuthCallbackauth_callback:auth_callback | A functionfunction with the form `function(tokenParams, callback(err, tokenOrTokenRequest))``TokenCallback` instancecallable (eg a lambda)proc / lambda (called synchronously in REST and Realtime but does not block EventMachine in the latter) which is called when a new token is required. The role of the callback is to obtain a fresh token, one of: an Ably Token string (in plain text format); a signed [`TokenRequest`](/docs/api/realtime-sdk/types#token-request); a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) (in JSON format); an [Ably JWT](/docs/api/realtime-sdk/authentication#ably-jwt). See [our authentication documentation](/docs/platform/auth) for details of the Ably TokenRequest format and associated API calls. | `Callable``TokenCallback``Proc` | | authUrlAuthUrl:auth_urlauth_url | A URL that the library may use to obtain a fresh token, one of: an Ably Token string (in plain text format); a signed [`TokenRequest`](/docs/api/realtime-sdk/types#token-request); a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) (in JSON format); an [Ably JWT](/docs/api/realtime-sdk/authentication#ably-jwt). For example, this can be used by a client to obtain signed Ably TokenRequests from an application server. | `String``NSURL` | | authMethodAuthMethodauth_method:auth_method | The HTTP verb to use for the request, either `GET``:get` or `POST``:post`
_default: `GET``:get`_ | `String``Symbol` | | authHeadersAuthHeadersauth_headers:auth_headers | A set of key value pair headers to be added to any request made to the `authUrl`. Useful when an application requires these to be added to validate the request or implement the response. If the `authHeaders` object contains an `authorization` key, then `withCredentials` will be set on the xhr request. | `Object``Dict``Hash``Associative Array``Param []``Map` | | authParamsAuthParams:auth_paramsauth_params | A set of key value pair params to be added to any request made to the `authUrl`. When the `authMethod``AuthMethod` is `GET`, query params are added to the URL, whereas when `authMethod``AuthMethod` is `POST`, the params are sent as URL encoded form data. Useful when an application require these to be added to validate the request or implement the response. | `Object``Hash``Associative Array``Param[]``NSArray``[NSURLQueryItem]/Array``Map` | -| tokenDetailsTokenDetailstoken_details:token_details | An authenticated [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) object (most commonly obtained from an Ably Token Request response). This option is mostly useful for testing: since tokens are short-lived, in production you almost always want to use an authentication method that allows the client library to renew the token automatically when the previous one expires, such as `authUrl``AuthUrl``:auth_url``auth_url` or `authCallback`AuthCallback`auth_callback``:auth_callback`. Use this option if you wish to use Token authentication. Read more about [Token authentication](/docs/auth/token) | `TokenDetails` | +| tokenDetailsTokenDetailstoken_details:token_details | An authenticated [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) object (most commonly obtained from an Ably Token Request response). This option is mostly useful for testing: since tokens are short-lived, in production you almost always want to use an authentication method that allows the client library to renew the token automatically when the previous one expires, such as `authUrl``AuthUrl``:auth_url``auth_url` or `authCallback`AuthCallback`auth_callback``:auth_callback`. Use this option if you wish to use Token authentication. Read more about [Token authentication](/docs/platform/auth/token) | `TokenDetails` | | tlsTls:tls | A boolean value, indicating whether or not a TLS ("SSL") secure connection should be used. An insecure connection cannot be used with Basic authentication as it would lead to a possible compromise of the private API key while in transit. [Find out more about TLS](https://faqs.ably.com/are-messages-sent-to-and-received-from-ably-securely-using-tls)
_default: true_ | `Boolean` | -| clientIdClientIdclient_id:client_id | A client ID, used for identifying this client when publishing messages or for presence purposes. The `clientId``client_id``ClientId` can be any non-empty string. This option is primarily intended to be used in situations where the library is instantiated with a key; note that a `clientId``client_id``ClientId` may also be implicit in a token used to instantiate the library; an error will be raised if a `clientId``client_id` specified here conflicts with the `clientId``client_id``ClientId` implicit in the token. [Find out more about client identities](/docs/auth/identified-clients) | `String` | -| useTokenAuthUseTokenAuthuse_token_auth:use_token_auth | When true, forces [Token authentication](/docs/auth/token) to be used by the library. Please note that if a `client_id``clientId` is not specified in the [`ClientOptions`](/docs/api/realtime-sdk/types#client-options) or [`TokenParams`](/docs/api/realtime-sdk/types#token-params), then the Ably Token issued will be [anonymous](https://faqs.ably.com/authenticated-and-identified-clients).
_default: false_ | `Boolean` | +| clientIdClientIdclient_id:client_id | A client ID, used for identifying this client when publishing messages or for presence purposes. The `clientId``client_id``ClientId` can be any non-empty string. This option is primarily intended to be used in situations where the library is instantiated with a key; note that a `clientId``client_id``ClientId` may also be implicit in a token used to instantiate the library; an error will be raised if a `clientId``client_id` specified here conflicts with the `clientId``client_id``ClientId` implicit in the token. [Find out more about client identities](/docs/platform/auth/identified-clients) | `String` | +| useTokenAuthUseTokenAuthuse_token_auth:use_token_auth | When true, forces [Token authentication](/docs/platform/auth/token) to be used by the library. Please note that if a `client_id``clientId` is not specified in the [`ClientOptions`](/docs/api/realtime-sdk/types#client-options) or [`TokenParams`](/docs/api/realtime-sdk/types#token-params), then the Ably Token issued will be [anonymous](https://faqs.ably.com/authenticated-and-identified-clients).
_default: false_ | `Boolean` | | endpointEndpoint:endpoint | Enables [enterprise customers](https://ably.com/pricing) to use their own custom endpoints, which support dedicated, isolated clusters and regional message routing and storage constraints. See our [platform customization guide](/docs/platform/account/enterprise-customization) for more details.
_default: nullNullNonenil_ | `String` | | environmentEnvironment:environment | Deprecated, use `endpoint`. Enables [enterprise customers](https://ably.com/pricing) to use their own custom environments, which support dedicated, isolated clusters and regional message routing and storage constraints. See our [platform customization guide](/docs/platform/account/enterprise-customization) for more details.
_default: nullNullNonenil_ | `String` | | idempotentRestPublishingIdempotentRestPublishing:idempotent_rest_publishing | When true, enables idempotent publishing by assigning a unique message ID client-side, allowing the Ably servers to discard automatic publish retries following a failure such as a network fault. We recommend you enable this by default. In version 1.2 onwards, idempotent publishing for retries will be enabled by default.
_default: false_ | `Boolean` | @@ -706,7 +706,7 @@ Returns a promise. On success, the promise is fulfilled with a [`BatchResult`](# | logHandlerlog_handler | A function to handle each line of the library's log output. If `logHandler` is not specified, `console.log` is used. | `Callable` | | transports | An optional array of transports to use, in descending order of preference. In the browser environment the available transports are: `web_socket`, `xhr_polling`. | `String[]` | | useBinaryProtocoluse_binary_protocol | If set to true, will enable the binary protocol (MessagePack) if it is supported. It's disabled by default on browsers for performance considerations (browsers are optimized for decoding JSON). Find out more about the [benefits of binary encoding](https://faqs.ably.com/do-you-binary-encode-your-messages-for-greater-efficiency)
_default: false_ | `Boolean` | -| queryTimeQueryTime:query_timequery_time | If true, the library will query the Ably servers for the current time when [issuing TokenRequests](/docs/auth/token) instead of relying on a locally-available time of day. Knowing the time accurately is needed to create valid signed Ably [`TokenRequests`](/docs/api/rest-sdk/authentication#token-request), so this option is useful for library instances on auth servers where for some reason the server clock cannot be kept synchronized through normal means, such as an [NTP daemon](https://en.wikipedia.org/wiki/Ntpd). The server is queried for the current time once per client library instance (which stores the offset from the local clock), so if using this option you should avoid instancing a new version of the library for each request.
_default: false_ | `Boolean` | +| queryTimeQueryTime:query_timequery_time | If true, the library will query the Ably servers for the current time when [issuing TokenRequests](/docs/platform/auth/token) instead of relying on a locally-available time of day. Knowing the time accurately is needed to create valid signed Ably [`TokenRequests`](/docs/api/rest-sdk/authentication#token-request), so this option is useful for library instances on auth servers where for some reason the server clock cannot be kept synchronized through normal means, such as an [NTP daemon](https://en.wikipedia.org/wiki/Ntpd). The server is queried for the current time once per client library instance (which stores the offset from the local clock), so if using this option you should avoid instancing a new version of the library for each request.
_default: false_ | `Boolean` | | defaultTokenParamsdefault_token_params:default_token_paramsDefaultTokenParams | When a [`TokenParams`](/docs/api/rest-sdk/types#token-params) object is provided, it will override the client library defaults when issuing new [Ably Tokens](/docs/api/realtime-sdk/authentication#token-details) or [Ably `TokenRequests`](/docs/api/rest-sdk/authentication#token-request) | [`TokenParams`](/docs/api/rest-sdk/types#token-params) |
@@ -716,17 +716,17 @@ Returns a promise. On success, the promise is fulfilled with a [`BatchResult`](# | Parameter | Description | Type | |-----------|-------------|------| -| Key | The full key string, as obtained from the [application dashboard](https://ably.com/dashboard). Use this option if you wish to use Basic authentication, or wish to be able to issue Ably Tokens without needing to defer to a separate entity to sign Ably TokenRequests. Read more about [Basic authentication](/docs/auth/basic) | `String` | -| Token | An authenticated token. This can either be a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) object, a [`TokenRequest`](/docs/api/realtime-sdk/types#token-request) object, or token string (obtained from the `Token` property of a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) component of an Ably TokenRequest response, or a [JSON Web Token](https://tools.ietf.org/html/rfc7519) satisfying [the Ably requirements for JWTs](/docs/auth/token#jwt)). This option is mostly useful for testing: since tokens are short-lived, in production you almost always want to use an authentication method that allows the client library to renew the token automatically when the previous one expires, such as `AuthUrl` or `AuthCallback`. Read more about [Token authentication](/docs/auth/token) | `String`, `TokenDetails` or `TokenRequest` | -| AuthCallback | A function which is called when a new token is required. The role of the callback is to obtain a fresh token, one of: an Ably Token string (in plain text format); a signed [`TokenRequest`](/docs/api/realtime-sdk/types#token-request); a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) (in JSON format); an [Ably JWT](/docs/api/realtime-sdk/authentication#ably-jwt). See [our authentication documentation](/docs/auth) for details of the Ably TokenRequest format and associated API calls. | `Callable` | +| Key | The full key string, as obtained from the [application dashboard](https://ably.com/dashboard). Use this option if you wish to use Basic authentication, or wish to be able to issue Ably Tokens without needing to defer to a separate entity to sign Ably TokenRequests. Read more about [Basic authentication](/docs/platform/auth/basic) | `String` | +| Token | An authenticated token. This can either be a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) object, a [`TokenRequest`](/docs/api/realtime-sdk/types#token-request) object, or token string (obtained from the `Token` property of a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) component of an Ably TokenRequest response, or a [JSON Web Token](https://tools.ietf.org/html/rfc7519) satisfying [the Ably requirements for JWTs](/docs/platform/auth/token#jwt)). This option is mostly useful for testing: since tokens are short-lived, in production you almost always want to use an authentication method that allows the client library to renew the token automatically when the previous one expires, such as `AuthUrl` or `AuthCallback`. Read more about [Token authentication](/docs/platform/auth/token) | `String`, `TokenDetails` or `TokenRequest` | +| AuthCallback | A function which is called when a new token is required. The role of the callback is to obtain a fresh token, one of: an Ably Token string (in plain text format); a signed [`TokenRequest`](/docs/api/realtime-sdk/types#token-request); a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) (in JSON format); an [Ably JWT](/docs/api/realtime-sdk/authentication#ably-jwt). See [our authentication documentation](/docs/platform/auth) for details of the Ably TokenRequest format and associated API calls. | `Callable` | | AuthUrl | A URL that the library may use to obtain a fresh token, one of: an Ably Token string (in plain text format); a signed [`TokenRequest`](/docs/api/realtime-sdk/types#token-request); a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) (in JSON format); an [Ably JWT](/docs/api/realtime-sdk/authentication#ably-jwt). For example, this can be used by a client to obtain signed Ably TokenRequests from an application server. | `String` | | AuthMethod | The HTTP verb to use for the request, either `GET` or `POST`
_default: `GET`_ | `String` | | AuthHeaders | A set of key value pair headers to be added to any request made to the `authUrl`. Useful when an application requires these to be added to validate the request or implement the response. | `Object` | | AuthParams | A set of key value pair params to be added to any request made to the `authUrl`. When the `AuthMethod` is `GET`, query params are added to the URL, whereas when `AuthMethod` is `POST`, the params are sent as URL encoded form data. Useful when an application require these to be added to validate the request or implement the response. | `Object` | -| TokenDetails | An authenticated [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) object (most commonly obtained from an Ably Token Request response). This option is mostly useful for testing: since tokens are short-lived, in production you almost always want to use an authentication method that allows the client library to renew the token automatically when the previous one expires, such as `AuthUrl` or `AuthCallback`. Use this option if you wish to use Token authentication. Read more about [Token authentication](/docs/auth/token) | `TokenDetails` | +| TokenDetails | An authenticated [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) object (most commonly obtained from an Ably Token Request response). This option is mostly useful for testing: since tokens are short-lived, in production you almost always want to use an authentication method that allows the client library to renew the token automatically when the previous one expires, such as `AuthUrl` or `AuthCallback`. Use this option if you wish to use Token authentication. Read more about [Token authentication](/docs/platform/auth/token) | `TokenDetails` | | Tls | A boolean value, indicating whether or not a TLS ("SSL") secure connection should be used. An insecure connection cannot be used with Basic authentication as it would lead to a possible compromise of the private API key while in transit. [Find out more about TLS](https://faqs.ably.com/are-messages-sent-to-and-received-from-ably-securely-using-tls)
_default: true_ | `Boolean` | -| ClientId | A client ID, used for identifying this client when publishing messages or for presence purposes. The `ClientId` can be any non-empty string. This option is primarily intended to be used in situations where the library is instantiated with a key; note that a `ClientId` may also be implicit in a token used to instantiate the library; an error will be raised if a `ClientId` specified here conflicts with the `ClientId` implicit in the token. [Find out more about client identities](/docs/auth/identified-clients) | `String` | -| UseTokenAuth | When true, forces [Token authentication](/docs/auth/token) to be used by the library. Please note that if a `ClientId` is not specified in the [`ClientOptions`](/docs/api/realtime-sdk/types#client-options) or [`TokenParams`](/docs/api/realtime-sdk/types#token-params), then the Ably Token issued will be [anonymous](https://faqs.ably.com/authenticated-and-identified-clients).
_default: false_ | `Boolean` | +| ClientId | A client ID, used for identifying this client when publishing messages or for presence purposes. The `ClientId` can be any non-empty string. This option is primarily intended to be used in situations where the library is instantiated with a key; note that a `ClientId` may also be implicit in a token used to instantiate the library; an error will be raised if a `ClientId` specified here conflicts with the `ClientId` implicit in the token. [Find out more about client identities](/docs/platform/auth/identified-clients) | `String` | +| UseTokenAuth | When true, forces [Token authentication](/docs/platform/auth/token) to be used by the library. Please note that if a `ClientId` is not specified in the [`ClientOptions`](/docs/api/realtime-sdk/types#client-options) or [`TokenParams`](/docs/api/realtime-sdk/types#token-params), then the Ably Token issued will be [anonymous](https://faqs.ably.com/authenticated-and-identified-clients).
_default: false_ | `Boolean` | | Endpoint | Enables [enterprise customers](https://ably.com/pricing) to use their own custom endpoints, which support dedicated, isolated clusters and regional message routing and storage constraints. See our [platform customization guide](/docs/platform/account/enterprise-customization) for more details.
_default: null_ | `String` | | Environment | Deprecated, use `endpoint`. Enables [enterprise customers](https://ably.com/pricing) to use their own custom environments, which support dedicated, isolated clusters and regional message routing and storage constraints. See our [platform customization guide](/docs/platform/account/enterprise-customization) for more details.
_default: null_ | `String` | | IdempotentRestPublishing | When true, enables idempotent publishing by assigning a unique message ID client-side, allowing the Ably servers to discard automatic publish retries following a failure such as a network fault. We recommend you enable this by default. In version 1.2 onwards, idempotent publishing for retries will be enabled by default.
_default: false_ | `Boolean` | @@ -734,7 +734,7 @@ Returns a promise. On success, the promise is fulfilled with a [`BatchResult`](# | transportParams | Optional. Can be used to pass in arbitrary connection parameters, such as [`heartbeatInterval`](/docs/connect#heartbeats) and [`remainPresentFor`](/docs/presence-occupancy/presence#unstable-connections) | `Object` | | LogLevel | A number controlling the verbosity of the log output of the library. Valid values are: 0 (no logs), 1 (errors only), 2 (errors plus connection and channel state changes), 3 (high-level debug output), and 4 (full debug output). | `Integer` | | UseBinaryProtocol | If set to true, will enable the binary protocol (MessagePack) if it is supported. It's disabled by default on browsers for performance considerations (browsers are optimized for decoding JSON). Find out more about the [benefits of binary encoding](https://faqs.ably.com/do-you-binary-encode-your-messages-for-greater-efficiency)
_default: false_ | `Boolean` | -| QueryTime | If true, the library will query the Ably servers for the current time when [issuing TokenRequests](/docs/auth/token) instead of relying on a locally-available time of day. Knowing the time accurately is needed to create valid signed Ably [`TokenRequests`](/docs/api/rest-sdk/authentication#token-request), so this option is useful for library instances on auth servers where for some reason the server clock cannot be kept synchronized through normal means, such as an [NTP daemon](https://en.wikipedia.org/wiki/Ntpd). The server is queried for the current time once per client library instance (which stores the offset from the local clock), so if using this option you should avoid instancing a new version of the library for each request.
_default: false_ | `Boolean` | +| QueryTime | If true, the library will query the Ably servers for the current time when [issuing TokenRequests](/docs/platform/auth/token) instead of relying on a locally-available time of day. Knowing the time accurately is needed to create valid signed Ably [`TokenRequests`](/docs/api/rest-sdk/authentication#token-request), so this option is useful for library instances on auth servers where for some reason the server clock cannot be kept synchronized through normal means, such as an [NTP daemon](https://en.wikipedia.org/wiki/Ntpd). The server is queried for the current time once per client library instance (which stores the offset from the local clock), so if using this option you should avoid instancing a new version of the library for each request.
_default: false_ | `Boolean` | | DefaultTokenParams | When a [`TokenParams`](/docs/api/rest-sdk/types#token-params) object is provided, it will override the client library defaults when issuing new [Ably Tokens](/docs/api/realtime-sdk/authentication#token-details) or [Ably `TokenRequests`](/docs/api/rest-sdk/authentication#token-request) | [`TokenParams`](/docs/api/rest-sdk/types#token-params) |
@@ -745,17 +745,17 @@ Returns a promise. On success, the promise is fulfilled with a [`BatchResult`](# | Parameter | Description | Type | |-----------|-------------|------| -| :key | The full key string, as obtained from the [application dashboard](https://ably.com/dashboard). Use this option if you wish to use Basic authentication, or wish to be able to issue Ably Tokens without needing to defer to a separate entity to sign Ably TokenRequests. Read more about [Basic authentication](/docs/auth/basic) | `String` | -| :token | An authenticated token. This can either be a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) object, a [`TokenRequest`](/docs/api/realtime-sdk/types#token-request) object, or token string (obtained from the `token` property of a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) component of an Ably TokenRequest response, or a [JSON Web Token](https://tools.ietf.org/html/rfc7519) satisfying [the Ably requirements for JWTs](/docs/auth/token#jwt)). This option is mostly useful for testing: since tokens are short-lived, in production you almost always want to use an authentication method that allows the client library to renew the token automatically when the previous one expires, such as `:auth_url` or `:auth_callback`. Read more about [Token authentication](/docs/auth/token) | `String`, `TokenDetails` or `TokenRequest` | -| :auth_callback | A proc / lambda (called synchronously in REST and Realtime but does not block EventMachine in the latter) which is called when a new token is required. The role of the callback is to obtain a fresh token, one of: an Ably Token string (in plain text format); a signed [`TokenRequest`](/docs/api/realtime-sdk/types#token-request); a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) (in JSON format); an [Ably JWT](/docs/api/realtime-sdk/authentication#ably-jwt). See [our authentication documentation](/docs/auth) for details of the Ably TokenRequest format and associated API calls. | `Proc` | +| :key | The full key string, as obtained from the [application dashboard](https://ably.com/dashboard). Use this option if you wish to use Basic authentication, or wish to be able to issue Ably Tokens without needing to defer to a separate entity to sign Ably TokenRequests. Read more about [Basic authentication](/docs/platform/auth/basic) | `String` | +| :token | An authenticated token. This can either be a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) object, a [`TokenRequest`](/docs/api/realtime-sdk/types#token-request) object, or token string (obtained from the `token` property of a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) component of an Ably TokenRequest response, or a [JSON Web Token](https://tools.ietf.org/html/rfc7519) satisfying [the Ably requirements for JWTs](/docs/platform/auth/token#jwt)). This option is mostly useful for testing: since tokens are short-lived, in production you almost always want to use an authentication method that allows the client library to renew the token automatically when the previous one expires, such as `:auth_url` or `:auth_callback`. Read more about [Token authentication](/docs/platform/auth/token) | `String`, `TokenDetails` or `TokenRequest` | +| :auth_callback | A proc / lambda (called synchronously in REST and Realtime but does not block EventMachine in the latter) which is called when a new token is required. The role of the callback is to obtain a fresh token, one of: an Ably Token string (in plain text format); a signed [`TokenRequest`](/docs/api/realtime-sdk/types#token-request); a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) (in JSON format); an [Ably JWT](/docs/api/realtime-sdk/authentication#ably-jwt). See [our authentication documentation](/docs/platform/auth) for details of the Ably TokenRequest format and associated API calls. | `Proc` | | :auth_url | A URL that the library may use to obtain a fresh token, one of: an Ably Token string (in plain text format); a signed [`TokenRequest`](/docs/api/realtime-sdk/types#token-request); a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) (in JSON format); an [Ably JWT](/docs/api/realtime-sdk/authentication#ably-jwt). For example, this can be used by a client to obtain signed Ably TokenRequests from an application server. | `String` | | :auth_method | The HTTP verb to use for the request, either `:get` or `:post`
_default: `:get`_ | `Symbol` | | :auth_headers | A set of key value pair headers to be added to any request made to the `authUrl`. Useful when an application requires these to be added to validate the request or implement the response. | `Hash` | | :auth_params | A set of key value pair params to be added to any request made to the `authUrl`. When the `authMethod` is `GET`, query params are added to the URL, whereas when `authMethod` is `POST`, the params are sent as URL encoded form data. Useful when an application require these to be added to validate the request or implement the response. | `Hash` | -| :token_details | An authenticated [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) object (most commonly obtained from an Ably Token Request response). This option is mostly useful for testing: since tokens are short-lived, in production you almost always want to use an authentication method that allows the client library to renew the token automatically when the previous one expires, such as `:auth_url` or `:auth_callback`. Use this option if you wish to use Token authentication. Read more about [Token authentication](/docs/auth/token) | `TokenDetails` | +| :token_details | An authenticated [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) object (most commonly obtained from an Ably Token Request response). This option is mostly useful for testing: since tokens are short-lived, in production you almost always want to use an authentication method that allows the client library to renew the token automatically when the previous one expires, such as `:auth_url` or `:auth_callback`. Use this option if you wish to use Token authentication. Read more about [Token authentication](/docs/platform/auth/token) | `TokenDetails` | | :tls | A boolean value, indicating whether or not a TLS ("SSL") secure connection should be used. An insecure connection cannot be used with Basic authentication as it would lead to a possible compromise of the private API key while in transit. [Find out more about TLS](https://faqs.ably.com/are-messages-sent-to-and-received-from-ably-securely-using-tls)
_default: true_ | `Boolean` | -| :client_id | A client ID, used for identifying this client when publishing messages or for presence purposes. The `client_id` can be any non-empty string. This option is primarily intended to be used in situations where the library is instantiated with a key; note that a `client_id` may also be implicit in a token used to instantiate the library; an error will be raised if a `client_id` specified here conflicts with the `client_id` implicit in the token. [Find out more about client identities](/docs/auth/identified-clients) | `String` | -| :use_token_auth | When true, forces [Token authentication](/docs/auth/token) to be used by the library. Please note that if a `client_id` is not specified in the [`ClientOptions`](/docs/api/realtime-sdk/types#client-options) or [`TokenParams`](/docs/api/realtime-sdk/types#token-params), then the Ably Token issued will be [anonymous](https://faqs.ably.com/authenticated-and-identified-clients).
_default: false_ | `Boolean` | +| :client_id | A client ID, used for identifying this client when publishing messages or for presence purposes. The `client_id` can be any non-empty string. This option is primarily intended to be used in situations where the library is instantiated with a key; note that a `client_id` may also be implicit in a token used to instantiate the library; an error will be raised if a `client_id` specified here conflicts with the `client_id` implicit in the token. [Find out more about client identities](/docs/platform/auth/identified-clients) | `String` | +| :use_token_auth | When true, forces [Token authentication](/docs/platform/auth/token) to be used by the library. Please note that if a `client_id` is not specified in the [`ClientOptions`](/docs/api/realtime-sdk/types#client-options) or [`TokenParams`](/docs/api/realtime-sdk/types#token-params), then the Ably Token issued will be [anonymous](https://faqs.ably.com/authenticated-and-identified-clients).
_default: false_ | `Boolean` | | :endpoint | Enables [enterprise customers](https://ably.com/pricing) to use their own custom endpoints, which support dedicated, isolated clusters and regional message routing and storage constraints. See our [platform customization guide](/docs/platform/account/enterprise-customization) for more details.
_default: nil_ | `String` | | :environment | Deprecated, use `endpoint`. Enables [enterprise customers](https://ably.com/pricing) to use their own custom environments, which support dedicated, isolated clusters and regional message routing and storage constraints. See our [platform customization guide](/docs/platform/account/enterprise-customization) for more details.
_default: nil_ | `String` | | :idempotent_rest_publishing | When true, enables idempotent publishing by assigning a unique message ID client-side, allowing the Ably servers to discard automatic publish retries following a failure such as a network fault. We recommend you enable this by default. In version 1.2 onwards, idempotent publishing for retries will be enabled by default.
_default: false_ | `Boolean` | @@ -764,7 +764,7 @@ Returns a promise. On success, the promise is fulfilled with a [`BatchResult`](# | :log_level | A number controlling the verbosity of the log output of the library. Valid values are: 0 (no logs), 1 (errors only), 2 (errors plus connection and channel state changes), 3 (high-level debug output), and 4 (full debug output). | `Integer` | | :logger | A Ruby [`Logger`](http://ruby-doc.org/stdlib-1.9.3/libdoc/logger/rdoc/Logger.html) compatible object to handle each line of log output. If `logger` is not specified, `STDOUT` is used. | `STDOUT Logger` | | :use_binary_protocol | If set to false, will forcibly disable the binary protocol (MessagePack). The binary protocol is used by default unless it is not supported. The default is true. Find out more about the [benefits of binary encoding](https://faqs.ably.com/do-you-binary-encode-your-messages-for-greater-efficiency)
_default: true_ | `Boolean` | -| :query_time | If true, the library will query the Ably servers for the current time when [issuing TokenRequests](/docs/auth/token) instead of relying on a locally-available time of day. Knowing the time accurately is needed to create valid signed Ably [`TokenRequests`](/docs/api/rest-sdk/authentication#token-request), so this option is useful for library instances on auth servers where for some reason the server clock cannot be kept synchronized through normal means, such as an [NTP daemon](https://en.wikipedia.org/wiki/Ntpd). The server is queried for the current time once per client library instance (which stores the offset from the local clock), so if using this option you should avoid instancing a new version of the library for each request.
_default: false_ | `Boolean` | +| :query_time | If true, the library will query the Ably servers for the current time when [issuing TokenRequests](/docs/platform/auth/token) instead of relying on a locally-available time of day. Knowing the time accurately is needed to create valid signed Ably [`TokenRequests`](/docs/api/rest-sdk/authentication#token-request), so this option is useful for library instances on auth servers where for some reason the server clock cannot be kept synchronized through normal means, such as an [NTP daemon](https://en.wikipedia.org/wiki/Ntpd). The server is queried for the current time once per client library instance (which stores the offset from the local clock), so if using this option you should avoid instancing a new version of the library for each request.
_default: false_ | `Boolean` | | :default_token_params | When a [`TokenParams`](/docs/api/rest-sdk/types#token-params) object is provided, it will override the client library defaults when issuing new [Ably Tokens](/docs/api/realtime-sdk/authentication#token-details) or [Ably `TokenRequests`](/docs/api/rest-sdk/authentication#token-request) | [`TokenParams`](/docs/api/rest-sdk/types#token-params) | @@ -775,24 +775,24 @@ Returns a promise. On success, the promise is fulfilled with a [`BatchResult`](# | Parameter | Description | Type | |-----------|-------------|------| -| keyKey:key | The full key string, as obtained from the [application dashboard](https://ably.com/dashboard). Use this option if you wish to use Basic authentication, or wish to be able to issue Ably Tokens without needing to defer to a separate entity to sign Ably TokenRequests. Read more about [Basic authentication](/docs/auth/basic) | `String` | -| tokenToken:token | An authenticated token. This can either be a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) object, a [`TokenRequest`](/docs/api/realtime-sdk/types#token-request) object, or token string (obtained from the `token``Token` property of a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) component of an Ably TokenRequest response, or a [JSON Web Token](https://tools.ietf.org/html/rfc7519) satisfying [the Ably requirements for JWTs](/docs/auth/token#jwt)). This option is mostly useful for testing: since tokens are short-lived, in production you almost always want to use an authentication method that allows the client library to renew the token automatically when the previous one expires, such as `authUrl`:auth_urlauth_url or `authCallback``AuthCallback``auth_callback``:auth_callback`. Read more about [Token authentication](/docs/auth/token) | `String`, `TokenDetails` or `TokenRequest` | -| authCallbackAuthCallbackauth_callback:auth_callback | A functionfunction with the form `function(tokenParams, callback(err, tokenOrTokenRequest))``TokenCallback` instancecallable (eg a lambda)proc / lambda (called synchronously in REST and Realtime but does not block EventMachine in the latter) which is called when a new token is required. The role of the callback is to obtain a fresh token, one of: an Ably Token string (in plain text format); a signed [`TokenRequest`](/docs/api/realtime-sdk/types#token-request); a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) (in JSON format); an [Ably JWT](/docs/api/realtime-sdk/authentication#ably-jwt). See [our authentication documentation](/docs/auth) for details of the Ably TokenRequest format and associated API calls. | `Callable``TokenCallback``Proc` | +| keyKey:key | The full key string, as obtained from the [application dashboard](https://ably.com/dashboard). Use this option if you wish to use Basic authentication, or wish to be able to issue Ably Tokens without needing to defer to a separate entity to sign Ably TokenRequests. Read more about [Basic authentication](/docs/platform/auth/basic) | `String` | +| tokenToken:token | An authenticated token. This can either be a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) object, a [`TokenRequest`](/docs/api/realtime-sdk/types#token-request) object, or token string (obtained from the `token``Token` property of a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) component of an Ably TokenRequest response, or a [JSON Web Token](https://tools.ietf.org/html/rfc7519) satisfying [the Ably requirements for JWTs](/docs/platform/auth/token#jwt)). This option is mostly useful for testing: since tokens are short-lived, in production you almost always want to use an authentication method that allows the client library to renew the token automatically when the previous one expires, such as `authUrl`:auth_urlauth_url or `authCallback``AuthCallback``auth_callback``:auth_callback`. Read more about [Token authentication](/docs/platform/auth/token) | `String`, `TokenDetails` or `TokenRequest` | +| authCallbackAuthCallbackauth_callback:auth_callback | A functionfunction with the form `function(tokenParams, callback(err, tokenOrTokenRequest))``TokenCallback` instancecallable (eg a lambda)proc / lambda (called synchronously in REST and Realtime but does not block EventMachine in the latter) which is called when a new token is required. The role of the callback is to obtain a fresh token, one of: an Ably Token string (in plain text format); a signed [`TokenRequest`](/docs/api/realtime-sdk/types#token-request); a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) (in JSON format); an [Ably JWT](/docs/api/realtime-sdk/authentication#ably-jwt). See [our authentication documentation](/docs/platform/auth) for details of the Ably TokenRequest format and associated API calls. | `Callable``TokenCallback``Proc` | | authUrlAuthUrl:auth_urlauth_url | A URL that the library may use to obtain a fresh token, one of: an Ably Token string (in plain text format); a signed [`TokenRequest`](/docs/api/realtime-sdk/types#token-request); a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) (in JSON format); an [Ably JWT](/docs/api/realtime-sdk/authentication#ably-jwt). For example, this can be used by a client to obtain signed Ably TokenRequests from an application server. | `String``NSURL` | | authMethodAuthMethodauth_method:auth_method | The HTTP verb to use for the request, either `GET``:get` or `POST``:post`
_default: `GET``:get`_ | `String``Symbol` | | authHeadersAuthHeadersauth_headers:auth_headers | A set of key value pair headers to be added to any request made to the `authUrl`. Useful when an application requires these to be added to validate the request or implement the response. If the `authHeaders` object contains an `authorization` key, then `withCredentials` will be set on the xhr request. | `Object``Dict``Hash``Associative Array``Param []``Map` | | authParamsAuthParams:auth_paramsauth_params | A set of key value pair params to be added to any request made to the `authUrl`. When the `authMethod``AuthMethod` is `GET`, query params are added to the URL, whereas when `authMethod``AuthMethod` is `POST`, the params are sent as URL encoded form data. Useful when an application require these to be added to validate the request or implement the response. | `Object``Hash``Associative Array``Param[]``NSArray``[NSURLQueryItem]/Array``Map` | -| tokenDetailsTokenDetailstoken_details:token_details | An authenticated [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) object (most commonly obtained from an Ably Token Request response). This option is mostly useful for testing: since tokens are short-lived, in production you almost always want to use an authentication method that allows the client library to renew the token automatically when the previous one expires, such as `authUrl``AuthUrl``:auth_url``auth_url` or `authCallback`AuthCallback`auth_callback``:auth_callback`. Use this option if you wish to use Token authentication. Read more about [Token authentication](/docs/auth/token) | `TokenDetails` | +| tokenDetailsTokenDetailstoken_details:token_details | An authenticated [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) object (most commonly obtained from an Ably Token Request response). This option is mostly useful for testing: since tokens are short-lived, in production you almost always want to use an authentication method that allows the client library to renew the token automatically when the previous one expires, such as `authUrl``AuthUrl``:auth_url``auth_url` or `authCallback`AuthCallback`auth_callback``:auth_callback`. Use this option if you wish to use Token authentication. Read more about [Token authentication](/docs/platform/auth/token) | `TokenDetails` | | tlsTls:tls | A boolean value, indicating whether or not a TLS ("SSL") secure connection should be used. An insecure connection cannot be used with Basic authentication as it would lead to a possible compromise of the private API key while in transit. [Find out more about TLS](https://faqs.ably.com/are-messages-sent-to-and-received-from-ably-securely-using-tls)
_default: true_ | `Boolean` | -| clientIdClientIdclient_id:client_id | A client ID, used for identifying this client when publishing messages or for presence purposes. The `clientId``client_id``ClientId` can be any non-empty string. This option is primarily intended to be used in situations where the library is instantiated with a key; note that a `clientId``client_id``ClientId` may also be implicit in a token used to instantiate the library; an error will be raised if a `clientId``client_id` specified here conflicts with the `clientId``client_id``ClientId` implicit in the token. [Find out more about client identities](/docs/auth/identified-clients) | `String` | -| useTokenAuthUseTokenAuthuse_token_auth:use_token_auth | When true, forces [Token authentication](/docs/auth/token) to be used by the library. Please note that if a `client_id``clientId` is not specified in the [`ClientOptions`](/docs/api/realtime-sdk/types#client-options) or [`TokenParams`](/docs/api/realtime-sdk/types#token-params), then the Ably Token issued will be [anonymous](https://faqs.ably.com/authenticated-and-identified-clients).
_default: false_ | `Boolean` | +| clientIdClientIdclient_id:client_id | A client ID, used for identifying this client when publishing messages or for presence purposes. The `clientId``client_id``ClientId` can be any non-empty string. This option is primarily intended to be used in situations where the library is instantiated with a key; note that a `clientId``client_id``ClientId` may also be implicit in a token used to instantiate the library; an error will be raised if a `clientId``client_id` specified here conflicts with the `clientId``client_id``ClientId` implicit in the token. [Find out more about client identities](/docs/platform/auth/identified-clients) | `String` | +| useTokenAuthUseTokenAuthuse_token_auth:use_token_auth | When true, forces [Token authentication](/docs/platform/auth/token) to be used by the library. Please note that if a `client_id``clientId` is not specified in the [`ClientOptions`](/docs/api/realtime-sdk/types#client-options) or [`TokenParams`](/docs/api/realtime-sdk/types#token-params), then the Ably Token issued will be [anonymous](https://faqs.ably.com/authenticated-and-identified-clients).
_default: false_ | `Boolean` | | endpointEndpoint:endpoint | Enables [enterprise customers](https://ably.com/pricing) to use their own custom endpoints, which support dedicated, isolated clusters and regional message routing and storage constraints. See our [platform customization guide](/docs/platform/account/enterprise-customization) for more details.
_default: nullNullNonenil_ | `String` | | environmentEnvironment:environment | Deprecated, use `endpoint`. Enables [enterprise customers](https://ably.com/pricing) to use their own custom environments, which support dedicated, isolated clusters and regional message routing and storage constraints. See our [platform customization guide](/docs/platform/account/enterprise-customization) for more details.
_default: nullNullNonenil_ | `String` | | idempotentRestPublishingIdempotentRestPublishing:idempotent_rest_publishing | When true, enables idempotent publishing by assigning a unique message ID client-side, allowing the Ably servers to discard automatic publish retries following a failure such as a network fault. We recommend you enable this by default. In version 1.2 onwards, idempotent publishing for retries will be enabled by default.
_default: false_ | `Boolean` | | fallbackHostsFallbackHostsfallback_hosts:fallback_hosts | An array of fallback hosts to be used in the case of an error necessitating the use of an alternative host. When a custom environment is specified, the [fallback host functionality](https://faqs.ably.com/routing-around-network-and-dns-issues) is disabled. If your customer success manager has provided you with a set of custom fallback hosts, please specify them here.
_default: `[a.ably-realtime.com, b.ably-realtime.com, c.ably-realtime.com, d.ably-realtime.com, e.ably-realtime.com]`_ | `String []` | | transportParamstransport_params:transport_params | Optional. Can be used to pass in arbitrary connection parameters, such as [`heartbeatInterval`](/docs/connect#heartbeats) and [`remainPresentFor`](/docs/presence-occupancy/presence#unstable-connections) | `Object``Dict``Hash``Associative Array``Param []``Map` | | useBinaryProtocoluse_binary_protocol | If set to true, will enable the binary protocol (MessagePack) if it is supported. It's disabled by default on browsers for performance considerations (browsers are optimized for decoding JSON). Find out more about the [benefits of binary encoding](https://faqs.ably.com/do-you-binary-encode-your-messages-for-greater-efficiency)
_default: false_ | `Boolean` | -| queryTimeQueryTime:query_timequery_time | If true, the library will query the Ably servers for the current time when [issuing TokenRequests](/docs/auth/token) instead of relying on a locally-available time of day. Knowing the time accurately is needed to create valid signed Ably [`TokenRequests`](/docs/api/rest-sdk/authentication#token-request), so this option is useful for library instances on auth servers where for some reason the server clock cannot be kept synchronized through normal means, such as an [NTP daemon](https://en.wikipedia.org/wiki/Ntpd). The server is queried for the current time once per client library instance (which stores the offset from the local clock), so if using this option you should avoid instancing a new version of the library for each request.
_default: false_ | `Boolean` | +| queryTimeQueryTime:query_timequery_time | If true, the library will query the Ably servers for the current time when [issuing TokenRequests](/docs/platform/auth/token) instead of relying on a locally-available time of day. Knowing the time accurately is needed to create valid signed Ably [`TokenRequests`](/docs/api/rest-sdk/authentication#token-request), so this option is useful for library instances on auth servers where for some reason the server clock cannot be kept synchronized through normal means, such as an [NTP daemon](https://en.wikipedia.org/wiki/Ntpd). The server is queried for the current time once per client library instance (which stores the offset from the local clock), so if using this option you should avoid instancing a new version of the library for each request.
_default: false_ | `Boolean` | | defaultTokenParamsdefault_token_params:default_token_paramsDefaultTokenParams | When a [`TokenParams`](/docs/api/rest-sdk/types#token-params) object is provided, it will override the client library defaults when issuing new [Ably Tokens](/docs/api/realtime-sdk/authentication#token-details) or [Ably `TokenRequests`](/docs/api/rest-sdk/authentication#token-request) | [`TokenParams`](/docs/api/rest-sdk/types#token-params) | @@ -802,17 +802,17 @@ Returns a promise. On success, the promise is fulfilled with a [`BatchResult`](# | Parameter | Description | Type | |-----------|-------------|------| -| keyKey:key | The full key string, as obtained from the [application dashboard](https://ably.com/dashboard). Use this option if you wish to use Basic authentication, or wish to be able to issue Ably Tokens without needing to defer to a separate entity to sign Ably TokenRequests. Read more about [Basic authentication](/docs/auth/basic) | `String` | -| tokenToken:token | An authenticated token. This can either be a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) object, a [`TokenRequest`](/docs/api/realtime-sdk/types#token-request) object, or token string (obtained from the `token``Token` property of a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) component of an Ably TokenRequest response, or a [JSON Web Token](https://tools.ietf.org/html/rfc7519) satisfying [the Ably requirements for JWTs](/docs/auth/token#jwt)). This option is mostly useful for testing: since tokens are short-lived, in production you almost always want to use an authentication method that allows the client library to renew the token automatically when the previous one expires, such as `authUrl`:auth_urlauth_url or `authCallback``AuthCallback``auth_callback``:auth_callback`. Read more about [Token authentication](/docs/auth/token) | `String`, `TokenDetails` or `TokenRequest` | -| authCallbackAuthCallbackauth_callback:auth_callback | A functionfunction with the form `function(tokenParams, callback(err, tokenOrTokenRequest))``TokenCallback` instancecallable (eg a lambda)proc / lambda (called synchronously in REST and Realtime but does not block EventMachine in the latter) which is called when a new token is required. The role of the callback is to obtain a fresh token, one of: an Ably Token string (in plain text format); a signed [`TokenRequest`](/docs/api/realtime-sdk/types#token-request); a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) (in JSON format); an [Ably JWT](/docs/api/realtime-sdk/authentication#ably-jwt). See [our authentication documentation](/docs/auth) for details of the Ably TokenRequest format and associated API calls. | `Callable``TokenCallback``Proc` | +| keyKey:key | The full key string, as obtained from the [application dashboard](https://ably.com/dashboard). Use this option if you wish to use Basic authentication, or wish to be able to issue Ably Tokens without needing to defer to a separate entity to sign Ably TokenRequests. Read more about [Basic authentication](/docs/platform/auth/basic) | `String` | +| tokenToken:token | An authenticated token. This can either be a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) object, a [`TokenRequest`](/docs/api/realtime-sdk/types#token-request) object, or token string (obtained from the `token``Token` property of a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) component of an Ably TokenRequest response, or a [JSON Web Token](https://tools.ietf.org/html/rfc7519) satisfying [the Ably requirements for JWTs](/docs/platform/auth/token#jwt)). This option is mostly useful for testing: since tokens are short-lived, in production you almost always want to use an authentication method that allows the client library to renew the token automatically when the previous one expires, such as `authUrl`:auth_urlauth_url or `authCallback``AuthCallback``auth_callback``:auth_callback`. Read more about [Token authentication](/docs/platform/auth/token) | `String`, `TokenDetails` or `TokenRequest` | +| authCallbackAuthCallbackauth_callback:auth_callback | A functionfunction with the form `function(tokenParams, callback(err, tokenOrTokenRequest))``TokenCallback` instancecallable (eg a lambda)proc / lambda (called synchronously in REST and Realtime but does not block EventMachine in the latter) which is called when a new token is required. The role of the callback is to obtain a fresh token, one of: an Ably Token string (in plain text format); a signed [`TokenRequest`](/docs/api/realtime-sdk/types#token-request); a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) (in JSON format); an [Ably JWT](/docs/api/realtime-sdk/authentication#ably-jwt). See [our authentication documentation](/docs/platform/auth) for details of the Ably TokenRequest format and associated API calls. | `Callable``TokenCallback``Proc` | | authUrlAuthUrl:auth_urlauth_url | A URL that the library may use to obtain a fresh token, one of: an Ably Token string (in plain text format); a signed [`TokenRequest`](/docs/api/realtime-sdk/types#token-request); a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) (in JSON format); an [Ably JWT](/docs/api/realtime-sdk/authentication#ably-jwt). For example, this can be used by a client to obtain signed Ably TokenRequests from an application server. | `String``NSURL` | | authMethodAuthMethodauth_method:auth_method | The HTTP verb to use for the request, either `GET``:get` or `POST``:post`
_default: `GET``:get`_ | `String``Symbol` | | authHeadersAuthHeadersauth_headers:auth_headers | A set of key value pair headers to be added to any request made to the `authUrl`. Useful when an application requires these to be added to validate the request or implement the response. If the `authHeaders` object contains an `authorization` key, then `withCredentials` will be set on the xhr request. | `Object``Dict``Hash``Associative Array``Param []``Map` | | authParamsAuthParams:auth_paramsauth_params | A set of key value pair params to be added to any request made to the `authUrl`. When the `authMethod``AuthMethod` is `GET`, query params are added to the URL, whereas when `authMethod``AuthMethod` is `POST`, the params are sent as URL encoded form data. Useful when an application require these to be added to validate the request or implement the response. | `Object``Hash``Associative Array``Param[]``NSArray``[NSURLQueryItem]/Array``Map` | -| tokenDetailsTokenDetailstoken_details:token_details | An authenticated [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) object (most commonly obtained from an Ably Token Request response). This option is mostly useful for testing: since tokens are short-lived, in production you almost always want to use an authentication method that allows the client library to renew the token automatically when the previous one expires, such as `authUrl``AuthUrl``:auth_url``auth_url` or `authCallback`AuthCallback`auth_callback``:auth_callback`. Use this option if you wish to use Token authentication. Read more about [Token authentication](/docs/auth/token) | `TokenDetails` | +| tokenDetailsTokenDetailstoken_details:token_details | An authenticated [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) object (most commonly obtained from an Ably Token Request response). This option is mostly useful for testing: since tokens are short-lived, in production you almost always want to use an authentication method that allows the client library to renew the token automatically when the previous one expires, such as `authUrl``AuthUrl``:auth_url``auth_url` or `authCallback`AuthCallback`auth_callback``:auth_callback`. Use this option if you wish to use Token authentication. Read more about [Token authentication](/docs/platform/auth/token) | `TokenDetails` | | tlsTls:tls | A boolean value, indicating whether or not a TLS ("SSL") secure connection should be used. An insecure connection cannot be used with Basic authentication as it would lead to a possible compromise of the private API key while in transit. [Find out more about TLS](https://faqs.ably.com/are-messages-sent-to-and-received-from-ably-securely-using-tls)
_default: true_ | `Boolean` | -| clientIdClientIdclient_id:client_id | A client ID, used for identifying this client when publishing messages or for presence purposes. The `clientId``client_id``ClientId` can be any non-empty string. This option is primarily intended to be used in situations where the library is instantiated with a key; note that a `clientId``client_id``ClientId` may also be implicit in a token used to instantiate the library; an error will be raised if a `clientId``client_id` specified here conflicts with the `clientId``client_id``ClientId` implicit in the token. [Find out more about client identities](/docs/auth/identified-clients) | `String` | -| useTokenAuthUseTokenAuthuse_token_auth:use_token_auth | When true, forces [Token authentication](/docs/auth/token) to be used by the library. Please note that if a `client_id``clientId` is not specified in the [`ClientOptions`](/docs/api/realtime-sdk/types#client-options) or [`TokenParams`](/docs/api/realtime-sdk/types#token-params), then the Ably Token issued will be [anonymous](https://faqs.ably.com/authenticated-and-identified-clients).
_default: false_ | `Boolean` | +| clientIdClientIdclient_id:client_id | A client ID, used for identifying this client when publishing messages or for presence purposes. The `clientId``client_id``ClientId` can be any non-empty string. This option is primarily intended to be used in situations where the library is instantiated with a key; note that a `clientId``client_id``ClientId` may also be implicit in a token used to instantiate the library; an error will be raised if a `clientId``client_id` specified here conflicts with the `clientId``client_id``ClientId` implicit in the token. [Find out more about client identities](/docs/platform/auth/identified-clients) | `String` | +| useTokenAuthUseTokenAuthuse_token_auth:use_token_auth | When true, forces [Token authentication](/docs/platform/auth/token) to be used by the library. Please note that if a `client_id``clientId` is not specified in the [`ClientOptions`](/docs/api/realtime-sdk/types#client-options) or [`TokenParams`](/docs/api/realtime-sdk/types#token-params), then the Ably Token issued will be [anonymous](https://faqs.ably.com/authenticated-and-identified-clients).
_default: false_ | `Boolean` | | endpointEndpoint:endpoint | Enables [enterprise customers](https://ably.com/pricing) to use their own custom endpoints, which support dedicated, isolated clusters and regional message routing and storage constraints. See our [platform customization guide](/docs/platform/account/enterprise-customization) for more details.
_default: nullNullNonenil_ | `String` | | environmentEnvironment:environment | Deprecated, use `endpoint`. Enables [enterprise customers](https://ably.com/pricing) to use their own custom environments, which support dedicated, isolated clusters and regional message routing and storage constraints. See our [platform customization guide](/docs/platform/account/enterprise-customization) for more details.
_default: nullNullNonenil_ | `String` | | idempotentRestPublishingIdempotentRestPublishing:idempotent_rest_publishing | When true, enables idempotent publishing by assigning a unique message ID client-side, allowing the Ably servers to discard automatic publish retries following a failure such as a network fault. We recommend you enable this by default. In version 1.2 onwards, idempotent publishing for retries will be enabled by default.
_default: false_ | `Boolean` | @@ -821,7 +821,7 @@ Returns a promise. On success, the promise is fulfilled with a [`BatchResult`](# | logLevellog_level | A number controlling the verbosity of the log output of the library. Valid values are: 0 (no logs), 1 (errors only), 2 (errors plus connection and channel state changes), 3 (high-level debug output), and 4 (full debug output). | `Integer` | | logHandlerlog_handler | A function to handle each line of the library's log output. If `logHandler` is not specified, `console.log` is used. | `Callable` | | useBinaryProtocoluse_binary_protocol | If set to true, will enable the binary protocol (MessagePack) if it is supported. It's disabled by default on browsers for performance considerations (browsers are optimized for decoding JSON). Find out more about the [benefits of binary encoding](https://faqs.ably.com/do-you-binary-encode-your-messages-for-greater-efficiency)
_default: false_ | `Boolean` | -| queryTimeQueryTime:query_timequery_time | If true, the library will query the Ably servers for the current time when [issuing TokenRequests](/docs/auth/token) instead of relying on a locally-available time of day. Knowing the time accurately is needed to create valid signed Ably [`TokenRequests`](/docs/api/rest-sdk/authentication#token-request), so this option is useful for library instances on auth servers where for some reason the server clock cannot be kept synchronized through normal means, such as an [NTP daemon](https://en.wikipedia.org/wiki/Ntpd). The server is queried for the current time once per client library instance (which stores the offset from the local clock), so if using this option you should avoid instancing a new version of the library for each request.
_default: false_ | `Boolean` | +| queryTimeQueryTime:query_timequery_time | If true, the library will query the Ably servers for the current time when [issuing TokenRequests](/docs/platform/auth/token) instead of relying on a locally-available time of day. Knowing the time accurately is needed to create valid signed Ably [`TokenRequests`](/docs/api/rest-sdk/authentication#token-request), so this option is useful for library instances on auth servers where for some reason the server clock cannot be kept synchronized through normal means, such as an [NTP daemon](https://en.wikipedia.org/wiki/Ntpd). The server is queried for the current time once per client library instance (which stores the offset from the local clock), so if using this option you should avoid instancing a new version of the library for each request.
_default: false_ | `Boolean` | | defaultTokenParamsdefault_token_params:default_token_paramsDefaultTokenParams | When a [`TokenParams`](/docs/api/rest-sdk/types#token-params) object is provided, it will override the client library defaults when issuing new [Ably Tokens](/docs/api/realtime-sdk/authentication#token-details) or [Ably `TokenRequests`](/docs/api/rest-sdk/authentication#token-request) | [`TokenParams`](/docs/api/rest-sdk/types#token-params) | @@ -831,24 +831,24 @@ Returns a promise. On success, the promise is fulfilled with a [`BatchResult`](# | Parameter | Description | Type | |-----------|-------------|------| -| key | The full key string, as obtained from the [application dashboard](https://ably.com/dashboard). Use this option if you wish to use Basic authentication, or wish to be able to issue Ably Tokens without needing to defer to a separate entity to sign Ably TokenRequests. Read more about [Basic authentication](/docs/auth/basic) | `String` | -| token | An authenticated token. This can either be a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) object, a [`TokenRequest`](/docs/api/realtime-sdk/types#token-request) object, or token string (obtained from the `token` property of a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) component of an Ably TokenRequest response, or a [JSON Web Token](https://tools.ietf.org/html/rfc7519) satisfying [the Ably requirements for JWTs](/docs/auth/token#jwt)). This option is mostly useful for testing: since tokens are short-lived, in production you almost always want to use an authentication method that allows the client library to renew the token automatically when the previous one expires, such as `authUrl` or `authCallback`. Read more about [Token authentication](/docs/auth/token) | `String`, `TokenDetails` or `TokenRequest` | -| authCallback | A function which is called when a new token is required. The role of the callback is to obtain a fresh token, one of: an Ably Token string (in plain text format); a signed [`TokenRequest`](/docs/api/realtime-sdk/types#token-request); a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) (in JSON format); an [Ably JWT](/docs/api/realtime-sdk/authentication#ably-jwt). See [our authentication documentation](/docs/auth) for details of the Ably TokenRequest format and associated API calls. | `Callable` | +| key | The full key string, as obtained from the [application dashboard](https://ably.com/dashboard). Use this option if you wish to use Basic authentication, or wish to be able to issue Ably Tokens without needing to defer to a separate entity to sign Ably TokenRequests. Read more about [Basic authentication](/docs/platform/auth/basic) | `String` | +| token | An authenticated token. This can either be a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) object, a [`TokenRequest`](/docs/api/realtime-sdk/types#token-request) object, or token string (obtained from the `token` property of a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) component of an Ably TokenRequest response, or a [JSON Web Token](https://tools.ietf.org/html/rfc7519) satisfying [the Ably requirements for JWTs](/docs/platform/auth/token#jwt)). This option is mostly useful for testing: since tokens are short-lived, in production you almost always want to use an authentication method that allows the client library to renew the token automatically when the previous one expires, such as `authUrl` or `authCallback`. Read more about [Token authentication](/docs/platform/auth/token) | `String`, `TokenDetails` or `TokenRequest` | +| authCallback | A function which is called when a new token is required. The role of the callback is to obtain a fresh token, one of: an Ably Token string (in plain text format); a signed [`TokenRequest`](/docs/api/realtime-sdk/types#token-request); a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) (in JSON format); an [Ably JWT](/docs/api/realtime-sdk/authentication#ably-jwt). See [our authentication documentation](/docs/platform/auth) for details of the Ably TokenRequest format and associated API calls. | `Callable` | | authUrl | A URL that the library may use to obtain a fresh token, one of: an Ably Token string (in plain text format); a signed [`TokenRequest`](/docs/api/realtime-sdk/types#token-request); a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) (in JSON format); an [Ably JWT](/docs/api/realtime-sdk/authentication#ably-jwt). For example, this can be used by a client to obtain signed Ably TokenRequests from an application server. | `String` | | authMethod | The HTTP verb to use for the request, either `GET` or `POST`
_default: `GET`_ | `String` | | authHeaders | A set of key value pair headers to be added to any request made to the `authUrl`. Useful when an application requires these to be added to validate the request or implement the response. | `Map` | | authParams | A set of key value pair params to be added to any request made to the `authUrl`. When the `authMethod` is `GET`, query params are added to the URL, whereas when `authMethod` is `POST`, the params are sent as URL encoded form data. Useful when an application require these to be added to validate the request or implement the response. | `Map` | -| tokenDetails | An authenticated [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) object (most commonly obtained from an Ably Token Request response). This option is mostly useful for testing: since tokens are short-lived, in production you almost always want to use an authentication method that allows the client library to renew the token automatically when the previous one expires, such as `authUrl` or `authCallback`. Use this option if you wish to use Token authentication. Read more about [Token authentication](/docs/auth/token) | `TokenDetails` | +| tokenDetails | An authenticated [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) object (most commonly obtained from an Ably Token Request response). This option is mostly useful for testing: since tokens are short-lived, in production you almost always want to use an authentication method that allows the client library to renew the token automatically when the previous one expires, such as `authUrl` or `authCallback`. Use this option if you wish to use Token authentication. Read more about [Token authentication](/docs/platform/auth/token) | `TokenDetails` | | tls | A boolean value, indicating whether or not a TLS ("SSL") secure connection should be used. An insecure connection cannot be used with Basic authentication as it would lead to a possible compromise of the private API key while in transit. [Find out more about TLS](https://faqs.ably.com/are-messages-sent-to-and-received-from-ably-securely-using-tls)
_default: true_ | `Boolean` | -| clientId | A client ID, used for identifying this client when publishing messages or for presence purposes. The `clientId` can be any non-empty string. This option is primarily intended to be used in situations where the library is instantiated with a key; note that a `clientId` may also be implicit in a token used to instantiate the library; an error will be raised if a `clientId` specified here conflicts with the `clientId` implicit in the token. [Find out more about client identities](/docs/auth/identified-clients) | `String` | -| useTokenAuth | When true, forces [Token authentication](/docs/auth/token) to be used by the library. Please note that if a `clientId` is not specified in the [`ClientOptions`](/docs/api/realtime-sdk/types#client-options) or [`TokenParams`](/docs/api/realtime-sdk/types#token-params), then the Ably Token issued will be [anonymous](https://faqs.ably.com/authenticated-and-identified-clients).
_default: false_ | `Boolean` | +| clientId | A client ID, used for identifying this client when publishing messages or for presence purposes. The `clientId` can be any non-empty string. This option is primarily intended to be used in situations where the library is instantiated with a key; note that a `clientId` may also be implicit in a token used to instantiate the library; an error will be raised if a `clientId` specified here conflicts with the `clientId` implicit in the token. [Find out more about client identities](/docs/platform/auth/identified-clients) | `String` | +| useTokenAuth | When true, forces [Token authentication](/docs/platform/auth/token) to be used by the library. Please note that if a `clientId` is not specified in the [`ClientOptions`](/docs/api/realtime-sdk/types#client-options) or [`TokenParams`](/docs/api/realtime-sdk/types#token-params), then the Ably Token issued will be [anonymous](https://faqs.ably.com/authenticated-and-identified-clients).
_default: false_ | `Boolean` | | endpoint | Enables [enterprise customers](https://ably.com/pricing) to use their own custom endpoints, which support dedicated, isolated clusters and regional message routing and storage constraints. See our [platform customization guide](/docs/platform/account/enterprise-customization) for more details.
_default: null_ | `String` | | environment | Deprecated, use `endpoint`. Enables [enterprise customers](https://ably.com/pricing) to use their own custom environments, which support dedicated, isolated clusters and regional message routing and storage constraints. See our [platform customization guide](/docs/platform/account/enterprise-customization) for more details.
_default: null_ | `String` | | idempotentRestPublishing | When true, enables idempotent publishing by assigning a unique message ID client-side, allowing the Ably servers to discard automatic publish retries following a failure such as a network fault. We recommend you enable this by default. In version 1.2 onwards, idempotent publishing for retries will be enabled by default.
_default: false_ | `Boolean` | | fallbackHosts | An array of fallback hosts to be used in the case of an error necessitating the use of an alternative host. When a custom environment is specified, the [fallback host functionality](https://faqs.ably.com/routing-around-network-and-dns-issues) is disabled. If your customer success manager has provided you with a set of custom fallback hosts, please specify them here.
_default: `[a.ably-realtime.com, b.ably-realtime.com, c.ably-realtime.com, d.ably-realtime.com, e.ably-realtime.com]`_ | `String []` | | transportParams | Optional. Can be used to pass in arbitrary connection parameters, such as [`heartbeatInterval`](/docs/connect#heartbeats) and [`remainPresentFor`](/docs/presence-occupancy/presence#unstable-connections) | `Map` | | useBinaryProtocol | If set to true, will enable the binary protocol (MessagePack) if it is supported. It's disabled by default on browsers for performance considerations (browsers are optimized for decoding JSON). Find out more about the [benefits of binary encoding](https://faqs.ably.com/do-you-binary-encode-your-messages-for-greater-efficiency)
_default: false_ | `Boolean` | -| queryTime | If true, the library will query the Ably servers for the current time when [issuing TokenRequests](/docs/auth/token) instead of relying on a locally-available time of day. Knowing the time accurately is needed to create valid signed Ably [`TokenRequests`](/docs/api/rest-sdk/authentication#token-request), so this option is useful for library instances on auth servers where for some reason the server clock cannot be kept synchronized through normal means, such as an [NTP daemon](https://en.wikipedia.org/wiki/Ntpd). The server is queried for the current time once per client library instance (which stores the offset from the local clock), so if using this option you should avoid instancing a new version of the library for each request.
_default: false_ | `Boolean` | +| queryTime | If true, the library will query the Ably servers for the current time when [issuing TokenRequests](/docs/platform/auth/token) instead of relying on a locally-available time of day. Knowing the time accurately is needed to create valid signed Ably [`TokenRequests`](/docs/api/rest-sdk/authentication#token-request), so this option is useful for library instances on auth servers where for some reason the server clock cannot be kept synchronized through normal means, such as an [NTP daemon](https://en.wikipedia.org/wiki/Ntpd). The server is queried for the current time once per client library instance (which stores the offset from the local clock), so if using this option you should avoid instancing a new version of the library for each request.
_default: false_ | `Boolean` | | defaultTokenParams | When a [`TokenParams`](/docs/api/rest-sdk/types#token-params) object is provided, it will override the client library defaults when issuing new [Ably Tokens](/docs/api/realtime-sdk/authentication#token-details) or [Ably `TokenRequests`](/docs/api/rest-sdk/authentication#token-request) | [`TokenParams`](/docs/api/rest-sdk/types#token-params) | @@ -860,17 +860,17 @@ Returns a promise. On success, the promise is fulfilled with a [`BatchResult`](# | Parameter | Description | Type | |-----------|-------------|------| -| Key | The full key string, as obtained from the [application dashboard](https://ably.com/dashboard). Use this option if you wish to use Basic authentication, or wish to be able to issue Ably Tokens without needing to defer to a separate entity to sign Ably TokenRequests. Read more about [Basic authentication](/docs/auth/basic) | `String` | -| Token | An authenticated token. This can either be a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) object, a [`TokenRequest`](/docs/api/realtime-sdk/types#token-request) object, or token string (obtained from the `Token` property of a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) component of an Ably TokenRequest response, or a [JSON Web Token](https://tools.ietf.org/html/rfc7519) satisfying [the Ably requirements for JWTs](/docs/auth/token#jwt)). This option is mostly useful for testing: since tokens are short-lived, in production you almost always want to use an authentication method that allows the client library to renew the token automatically when the previous one expires, such as `AuthUrl` or `AuthCallback`. Read more about [Token authentication](/docs/auth/token) | `String`, `TokenDetails` or `TokenRequest` | -| AuthCallback | A function which is called when a new token is required. The role of the callback is to obtain a fresh token, one of: an Ably Token string (in plain text format); a signed [`TokenRequest`](/docs/api/realtime-sdk/types#token-request); a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) (in JSON format); an [Ably JWT](/docs/api/realtime-sdk/authentication#ably-jwt). See [our authentication documentation](/docs/auth) for details of the Ably TokenRequest format and associated API calls. | `Func>` | +| Key | The full key string, as obtained from the [application dashboard](https://ably.com/dashboard). Use this option if you wish to use Basic authentication, or wish to be able to issue Ably Tokens without needing to defer to a separate entity to sign Ably TokenRequests. Read more about [Basic authentication](/docs/platform/auth/basic) | `String` | +| Token | An authenticated token. This can either be a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) object, a [`TokenRequest`](/docs/api/realtime-sdk/types#token-request) object, or token string (obtained from the `Token` property of a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) component of an Ably TokenRequest response, or a [JSON Web Token](https://tools.ietf.org/html/rfc7519) satisfying [the Ably requirements for JWTs](/docs/platform/auth/token#jwt)). This option is mostly useful for testing: since tokens are short-lived, in production you almost always want to use an authentication method that allows the client library to renew the token automatically when the previous one expires, such as `AuthUrl` or `AuthCallback`. Read more about [Token authentication](/docs/platform/auth/token) | `String`, `TokenDetails` or `TokenRequest` | +| AuthCallback | A function which is called when a new token is required. The role of the callback is to obtain a fresh token, one of: an Ably Token string (in plain text format); a signed [`TokenRequest`](/docs/api/realtime-sdk/types#token-request); a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) (in JSON format); an [Ably JWT](/docs/api/realtime-sdk/authentication#ably-jwt). See [our authentication documentation](/docs/platform/auth) for details of the Ably TokenRequest format and associated API calls. | `Func>` | | AuthUrl | A URL that the library may use to obtain a fresh token, one of: an Ably Token string (in plain text format); a signed [`TokenRequest`](/docs/api/realtime-sdk/types#token-request); a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) (in JSON format); an [Ably JWT](/docs/api/realtime-sdk/authentication#ably-jwt). For example, this can be used by a client to obtain signed Ably TokenRequests from an application server. | `Uri` | | AuthMethod | The HTTP verb to use for the request, either `GET` or `POST`
_default: `GET`_ | `HttpMethod` | | AuthHeaders | A set of key value pair headers to be added to any request made to the `AuthUrl`. Useful when an application requires these to be added to validate the request or implement the response. | `Dictionary` | | AuthParams | A set of key value pair params to be added to any request made to the `AuthUrl`. When the `AuthMethod` is `GET`, query params are added to the URL, whereas when `AuthMethod` is `POST`, the params are sent as URL encoded form data. Useful when an application require these to be added to validate the request or implement the response. | `Dictionary` | -| TokenDetails | An authenticated [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) object (most commonly obtained from an Ably Token Request response). This option is mostly useful for testing: since tokens are short-lived, in production you almost always want to use an authentication method that allows the client library to renew the token automatically when the previous one expires, such as `AuthUrl` or `AuthCallback`. Use this option if you wish to use Token authentication. Read more about [Token authentication](/docs/auth/token) | `TokenDetails` | +| TokenDetails | An authenticated [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) object (most commonly obtained from an Ably Token Request response). This option is mostly useful for testing: since tokens are short-lived, in production you almost always want to use an authentication method that allows the client library to renew the token automatically when the previous one expires, such as `AuthUrl` or `AuthCallback`. Use this option if you wish to use Token authentication. Read more about [Token authentication](/docs/platform/auth/token) | `TokenDetails` | | Tls | A boolean value, indicating whether or not a TLS ("SSL") secure connection should be used. An insecure connection cannot be used with Basic authentication as it would lead to a possible compromise of the private API key while in transit. [Find out more about TLS](https://faqs.ably.com/are-messages-sent-to-and-received-from-ably-securely-using-tls)
_default: true_ | `Boolean` | -| ClientId | A client ID, used for identifying this client when publishing messages or for presence purposes. The `ClientId` can be any non-empty string. This option is primarily intended to be used in situations where the library is instantiated with a key; note that a `ClientId` may also be implicit in a token used to instantiate the library; an error will be raised if a `ClientId` specified here conflicts with the `ClientId` implicit in the token. [Find out more about client identities](/docs/auth/identified-clients) | `String` | -| UseTokenAuth | When true, forces [Token authentication](/docs/auth/token) to be used by the library. Please note that if a `clientId` is not specified in the [`ClientOptions`](/docs/api/realtime-sdk/types#client-options) or [`TokenParams`](/docs/api/realtime-sdk/types#token-params), then the Ably Token issued will be [anonymous](https://faqs.ably.com/authenticated-and-identified-clients).
_default: false_ | `Boolean` | +| ClientId | A client ID, used for identifying this client when publishing messages or for presence purposes. The `ClientId` can be any non-empty string. This option is primarily intended to be used in situations where the library is instantiated with a key; note that a `ClientId` may also be implicit in a token used to instantiate the library; an error will be raised if a `ClientId` specified here conflicts with the `ClientId` implicit in the token. [Find out more about client identities](/docs/platform/auth/identified-clients) | `String` | +| UseTokenAuth | When true, forces [Token authentication](/docs/platform/auth/token) to be used by the library. Please note that if a `clientId` is not specified in the [`ClientOptions`](/docs/api/realtime-sdk/types#client-options) or [`TokenParams`](/docs/api/realtime-sdk/types#token-params), then the Ably Token issued will be [anonymous](https://faqs.ably.com/authenticated-and-identified-clients).
_default: false_ | `Boolean` | | Endpoint | Enables [enterprise customers](https://ably.com/pricing) to use their own custom endpoints, which support dedicated, isolated clusters and regional message routing and storage constraints. See our [platform customization guide](/docs/platform/account/enterprise-customization) for more details.
_default: null_ | `String` | | Environment | Deprecated, use `Endpoint`. Enables [enterprise customers](https://ably.com/pricing) to use their own custom environments, which support dedicated, isolated clusters and regional message routing and storage constraints. See our [platform customization guide](/docs/platform/account/enterprise-customization) for more details.
_default: null_ | `String` | | IdempotentRestPublishing | When true, enables idempotent publishing by assigning a unique message ID client-side, allowing the Ably servers to discard automatic publish retries following a failure such as a network fault. We recommend you enable this by default. In version 1.2 onwards, idempotent publishing for retries will be enabled by default.
_default: false_ | `Boolean` | @@ -879,7 +879,7 @@ Returns a promise. On success, the promise is fulfilled with a [`BatchResult`](# | LogLevel | A number controlling the verbosity of the log output of the library. Valid values are: 0 (no logs), 1 (errors only), 2 (errors plus connection and channel state changes), 3 (high-level debug output), and 4 (full debug output). | `Integer` | | LoggerSink | The default ILoggerSink outputs messages to the debug console. This property allows the user to pipe the log messages to their own logging infrastructure.
_default: IO.Ably.DefaultLoggerSink_ | `ILoggerSink` | | UseBinaryProtocol | If set to true, will enable the binary protocol (MessagePack) if it is supported. It's disabled by default on browsers for performance considerations (browsers are optimized for decoding JSON). Find out more about the [benefits of binary encoding](https://faqs.ably.com/do-you-binary-encode-your-messages-for-greater-efficiency)
_default: false_ | `Boolean` | -| QueryTime | If true, the library will query the Ably servers for the current time when [issuing TokenRequests](/docs/auth/token) instead of relying on a locally-available time of day. Knowing the time accurately is needed to create valid signed Ably [`TokenRequests`](/docs/api/rest-sdk/authentication#token-request), so this option is useful for library instances on auth servers where for some reason the server clock cannot be kept synchronized through normal means, such as an [NTP daemon](https://en.wikipedia.org/wiki/Ntpd). The server is queried for the current time once per client library instance (which stores the offset from the local clock), so if using this option you should avoid instancing a new version of the library for each request.
_default: false_ | `Boolean` | +| QueryTime | If true, the library will query the Ably servers for the current time when [issuing TokenRequests](/docs/platform/auth/token) instead of relying on a locally-available time of day. Knowing the time accurately is needed to create valid signed Ably [`TokenRequests`](/docs/api/rest-sdk/authentication#token-request), so this option is useful for library instances on auth servers where for some reason the server clock cannot be kept synchronized through normal means, such as an [NTP daemon](https://en.wikipedia.org/wiki/Ntpd). The server is queried for the current time once per client library instance (which stores the offset from the local clock), so if using this option you should avoid instancing a new version of the library for each request.
_default: false_ | `Boolean` | | DefaultTokenParams | When a [`TokenParams`](/docs/api/rest-sdk/types#token-params) object is provided, it will override the client library defaults when issuing new [Ably Tokens](/docs/api/realtime-sdk/authentication#token-details) or [Ably `TokenRequests`](/docs/api/rest-sdk/authentication#token-request) | [`TokenParams`](/docs/api/rest-sdk/types#token-params) | diff --git a/src/pages/docs/api/rest-sdk/authentication.mdx b/src/pages/docs/api/rest-sdk/authentication.mdx index 97023b4331..2c208b3a1a 100644 --- a/src/pages/docs/api/rest-sdk/authentication.mdx +++ b/src/pages/docs/api/rest-sdk/authentication.mdx @@ -29,7 +29,7 @@ In the documentation, references to Ably-compatible tokens typically refer eithe ## Auth object
-The principal use-case for the `Auth` object is to create Ably [`TokenRequest`](#token-request) objects with [`createTokenRequest`](#create-token-request) or obtain [Ably Tokens](#token-details) from Ably with [`requestToken`](#request-token), and then issue them to other "less trusted" clients. Typically, your servers should be the only devices to have a [private API key](/docs/auth#api-key), and this private API key is used to securely sign Ably [`TokenRequest`](#token-request) objects or request [Ably Tokens](#token-details) from Ably. Clients are then issued with these short-lived [Ably Tokens](#token-details) or Ably [`TokenRequest`](#token-request) objects, and the libraries can then use these to authenticate with Ably. If you adopt this model, your private API key is never shared with clients directly. +The principal use-case for the `Auth` object is to create Ably [`TokenRequest`](#token-request) objects with [`createTokenRequest`](#create-token-request) or obtain [Ably Tokens](#token-details) from Ably with [`requestToken`](#request-token), and then issue them to other "less trusted" clients. Typically, your servers should be the only devices to have a [private API key](/docs/platform/auth#api-key), and this private API key is used to securely sign Ably [`TokenRequest`](#token-request) objects or request [Ably Tokens](#token-details) from Ably. Clients are then issued with these short-lived [Ably Tokens](#token-details) or Ably [`TokenRequest`](#token-request) objects, and the libraries can then use these to authenticate with Ably. If you adopt this model, your private API key is never shared with clients directly. A subsidiary use-case for the `Auth` object is to preemptively trigger renewal of a token or to acquire a new token with a revised set of capabilities by explicitly calling [`authorize`](#authorize)[`Authorize`](#authorize). @@ -339,11 +339,11 @@ fmt.Println(token) -Creates and signs an Ably [`TokenRequest`](#request-token) based on the specified `token_params` and `auth_options``tokenParams` and `authOptions``TokenParams` and `AuthOptions``tokenParams` and `authOptions`. Note this can only be used when the [API `key`](/docs/auth#api-key) value is available locally, due to it being required to sign the Ably [`TokenRequest`](#request-token). Otherwise, Ably [`TokenRequests`](#request-token) must be obtained from the key owner. Use this to generate Ably [`TokenRequests`](#request-token) in order to implement an [Ably Token](#token-details) request callback for use by other clients. +Creates and signs an Ably [`TokenRequest`](#request-token) based on the specified `token_params` and `auth_options``tokenParams` and `authOptions``TokenParams` and `AuthOptions``tokenParams` and `authOptions`. Note this can only be used when the [API `key`](/docs/platform/auth#api-key) value is available locally, due to it being required to sign the Ably [`TokenRequest`](#request-token). Otherwise, Ably [`TokenRequests`](#request-token) must be obtained from the key owner. Use this to generate Ably [`TokenRequests`](#request-token) in order to implement an [Ably Token](#token-details) request callback for use by other clients. Both `auth_options` and `token_params``authOptions` and `tokenParams``AuthOptions` and `TokenParams``authOptions` and `tokenParams` are optional. When omitted or `null``Null``None``nil`, the default Ably-compatible token parameters and authentication options for the client library are used, as specified in the `ClientOptions` when the client library was instantiated, or later updated with an explicit [`authorize`](#authorize)[`Authorize`](#authorize) request. Values passed in will be used instead of (rather than being merged with) the default values. -To understand why an Ably [`TokenRequest`](#request-token) may be issued to clients in favor of an [Ably Token](#token-details), see [Token Authentication explained](/docs/auth/token). +To understand why an Ably [`TokenRequest`](#request-token) may be issued to clients in favor of an [Ably Token](#token-details), see [Token Authentication explained](/docs/platform/auth/token). #### Parameters @@ -582,7 +582,7 @@ Calls the [`request Both `auth_options` and `token_params``authOptions` and `tokenParams``authOptions` and `tokenParams` are optional. When omitted or `null``Null``None``nil``null`, the default token parameters and authentication options for the client library are used, as specified in the `ClientOptions` when the client library was instantiated, or later updated with an explicit [`authorize`](#authorize)[`Authorize`](#authorize) request. Values passed in will be used instead of (rather than being merged with) the default values. -To understand why an Ably [`TokenRequest`](#request-token) may be issued to clients in favor of an [Ably Token](#token-details), see [Token Authentication explained](/docs/auth/token). +To understand why an Ably [`TokenRequest`](#request-token) may be issued to clients in favor of an [Ably Token](#token-details), see [Token Authentication explained](/docs/platform/auth/token). #### Parameters @@ -800,7 +800,7 @@ fmt.Println(token) Calls the [`revokeTokens` REST API endpoint](/docs/api/rest-api#revoke-tokens) to revoke tokens specified by the provided array of [`TokenRevocationTargetSpecifier`](#token-revocation-target-specifier). -Only tokens issued by an API key that had revocable tokens enabled before the token was issued can be revoked. See the [token revocation docs](/docs/auth/revocation) for more information. +Only tokens issued by an API key that had revocable tokens enabled before the token was issued can be revoked. See the [token revocation docs](/docs/platform/auth/revocation) for more information. #### Parameters @@ -854,42 +854,42 @@ try { ### AuthOptions ObjectAuthOptions Hashio.ably.lib.rest.Auth.AuthOptions -`AuthOptions` is a plain JavaScript object and is used when making [authentication](/docs/auth) requests. If passed in, an `authOptions` object will be used instead of (as opposed to supplementing or being merged with) the default values given when the library was instantiated. The following attributes are supported: +`AuthOptions` is a plain JavaScript object and is used when making [authentication](/docs/platform/auth) requests. If passed in, an `authOptions` object will be used instead of (as opposed to supplementing or being merged with) the default values given when the library was instantiated. The following attributes are supported: -`AuthOptions` is a Hash object and is used when making [authentication](/docs/auth) requests. These options will supplement or override the corresponding options given when the library was instantiated. The following key symbol values can be added to the Hash: +`AuthOptions` is a Hash object and is used when making [authentication](/docs/platform/auth) requests. These options will supplement or override the corresponding options given when the library was instantiated. The following key symbol values can be added to the Hash: -`AuthOptions` is a Dict and is used when making [authentication](/docs/auth) requests. These options will supplement or override the corresponding options given when the library was instantiated. The following key symbol values can be added to the Dict: +`AuthOptions` is a Dict and is used when making [authentication](/docs/platform/auth) requests. These options will supplement or override the corresponding options given when the library was instantiated. The following key symbol values can be added to the Dict: -`AuthOptions` is an Associative Array and is used when making [authentication](/docs/auth) requests. These options will supplement or override the corresponding options given when the library was instantiated. The following named keys and values can be added to the Associative Array: +`AuthOptions` is an Associative Array and is used when making [authentication](/docs/platform/auth) requests. These options will supplement or override the corresponding options given when the library was instantiated. The following named keys and values can be added to the Associative Array: -`AuthOptions` is used when making [authentication](/docs/auth) requests. These options will supplement or override the corresponding options given when the library was instantiated. +`AuthOptions` is used when making [authentication](/docs/platform/auth) requests. These options will supplement or override the corresponding options given when the library was instantiated. -`ARTAuthOptions` is used when making [authentication](/docs/auth) requests. These options will supplement or override the corresponding options given when the library was instantiated. +`ARTAuthOptions` is used when making [authentication](/docs/platform/auth) requests. These options will supplement or override the corresponding options given when the library was instantiated. #### PropertiesMembersAttributes | Name | Description | Type | |------|-------------|------| -| authCallbackAuthCallbackauth_callback:auth_callback | A functionfunction with the form `function(tokenParams, callback(err, tokenOrTokenRequest))``TokenCallback` instancecallable (eg a lambda)proc / lambda (called synchronously in REST and Realtime but does not block EventMachine in the latter)function which is called when a new token is required. The role of the callback is to obtain a fresh token, one of: an Ably Token string (in plain text format); a signed [`TokenRequest`](/docs/api/realtime-sdk/types#token-request); a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) (in JSON format); an [Ably JWT](/docs/api/realtime-sdk/authentication#ably-jwt). See [our authentication documentation](/docs/auth) for details of the Ably TokenRequest format and associated API calls. | `Callable``TokenCallback``Proc``Func>``Callable``Callable` | +| authCallbackAuthCallbackauth_callback:auth_callback | A functionfunction with the form `function(tokenParams, callback(err, tokenOrTokenRequest))``TokenCallback` instancecallable (eg a lambda)proc / lambda (called synchronously in REST and Realtime but does not block EventMachine in the latter)function which is called when a new token is required. The role of the callback is to obtain a fresh token, one of: an Ably Token string (in plain text format); a signed [`TokenRequest`](/docs/api/realtime-sdk/types#token-request); a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) (in JSON format); an [Ably JWT](/docs/api/realtime-sdk/authentication#ably-jwt). See [our authentication documentation](/docs/platform/auth) for details of the Ably TokenRequest format and associated API calls. | `Callable``TokenCallback``Proc``Func>``Callable``Callable` | | authUrlAuthUrl:auth_urlauth_url | A URL that the library may use to obtain a fresh token, one of: an Ably Token string (in plain text format); a signed [`TokenRequest`](/docs/api/realtime-sdk/types#token-request); a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) (in JSON format); an [Ably JWT](/docs/api/realtime-sdk/authentication#ably-jwt). For example, this can be used by a client to obtain signed Ably TokenRequests from an application server. | `String``Uri``NSURL` | | authMethodAuthMethodauth_method:auth_method | _`GET``:get`_ The HTTP verb to use for the request, either `GET``:get` or `POST``:post` | `String``Symbol``HttpMethod` | | authHeadersAuthHeadersauth_headers:auth_headers | A set of key value pair headers to be added to any request made to the authUrlAuthUrlAuthUrl. Useful when an application requires these to be added to validate the request or implement the response. If the `authHeaders` object contains an `authorization` key, then `withCredentials` will be set on the xhr request. | `Object``Dict``Hash``Associative Array``Param []``Dictionary` | | authParamsAuthParams:auth_paramsauth_params | A set of key value pair params to be added to any request made to the authUrlAuthUrl. When the authMethodAuthMethod is `GET`, query params are added to the URL, whereas when authMethodAuthMethod is `POST`, the params are sent as URL encoded form data. Useful when an application require these to be added to validate the request or implement the response. | `Object``Hash``Associative Array``Param[]``Dictionary``NSArray``[NSURLQueryItem]/Array``Object` | -| tokenDetailsTokenDetailstoken_details:token_details | An authenticated [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) object (most commonly obtained from an Ably Token Request response). This option is mostly useful for testing: since tokens are short-lived, in production you almost always want to use an authentication method that allows the client library to renew the token automatically when the previous one expires, such as authUrlAuthUrl:auth_urlauth_url or authCallbackAuthCallbackauth_callback:auth_callback. Use this option if you wish to use Token authentication. Read more about [Token authentication](/docs/auth/token) | `TokenDetails` | -| keyKey:keykey | Optionally the [API key](/docs/auth#api-key) to use can be specified as a full key string; if not, the API key passed into [`ClientOptions`](#client-options) when instancing the Realtime or REST library is used | `String` | -| queryTimeQueryTime:query_timequery_time | _false_ If true, the library will query the Ably servers for the current time when [issuing TokenRequests](/docs/auth/token) instead of relying on a locally-available time of day. Knowing the time accurately is needed to create valid signed Ably [TokenRequests](/docs/auth/token), so this option is useful for library instances on auth servers where for some reason the server clock cannot be kept synchronized through normal means, such as an [NTP daemon](https://en.wikipedia.org/wiki/Ntpd). The server is queried for the current time once per client library instance (which stores the offset from the local clock), so if using this option you should avoid instancing a new version of the library for each request. | `Boolean` | -| tokenToken:tokentoken | An authenticated token. This can either be a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) object, a [`TokenRequest`](/docs/api/realtime-sdk/types#token-request) object, or token string (obtained from the tokenTokentokentoken property of a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) component of an Ably TokenRequest response, or a [JSON Web Token](https://tools.ietf.org/html/rfc7519) satisfying [the Ably requirements for JWTs](/docs/auth/token#jwt)). This option is mostly useful for testing: since tokens are short-lived, in production you almost always want to use an authentication method that allows the client library to renew the token automatically when the previous one expires, such as authUrlAuthUrl:auth_urlauth_url or authCallbackAuthCallbackauth_callback:auth_callback. Read more about [Token authentication](/docs/auth/token) | `String`, `TokenDetails` or `TokenRequest` | +| tokenDetailsTokenDetailstoken_details:token_details | An authenticated [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) object (most commonly obtained from an Ably Token Request response). This option is mostly useful for testing: since tokens are short-lived, in production you almost always want to use an authentication method that allows the client library to renew the token automatically when the previous one expires, such as authUrlAuthUrl:auth_urlauth_url or authCallbackAuthCallbackauth_callback:auth_callback. Use this option if you wish to use Token authentication. Read more about [Token authentication](/docs/platform/auth/token) | `TokenDetails` | +| keyKey:keykey | Optionally the [API key](/docs/platform/auth#api-key) to use can be specified as a full key string; if not, the API key passed into [`ClientOptions`](#client-options) when instancing the Realtime or REST library is used | `String` | +| queryTimeQueryTime:query_timequery_time | _false_ If true, the library will query the Ably servers for the current time when [issuing TokenRequests](/docs/platform/auth/token) instead of relying on a locally-available time of day. Knowing the time accurately is needed to create valid signed Ably [TokenRequests](/docs/platform/auth/token), so this option is useful for library instances on auth servers where for some reason the server clock cannot be kept synchronized through normal means, such as an [NTP daemon](https://en.wikipedia.org/wiki/Ntpd). The server is queried for the current time once per client library instance (which stores the offset from the local clock), so if using this option you should avoid instancing a new version of the library for each request. | `Boolean` | +| tokenToken:tokentoken | An authenticated token. This can either be a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) object, a [`TokenRequest`](/docs/api/realtime-sdk/types#token-request) object, or token string (obtained from the tokenTokentokentoken property of a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) component of an Ably TokenRequest response, or a [JSON Web Token](https://tools.ietf.org/html/rfc7519) satisfying [the Ably requirements for JWTs](/docs/platform/auth/token#jwt)). This option is mostly useful for testing: since tokens are short-lived, in production you almost always want to use an authentication method that allows the client library to renew the token automatically when the previous one expires, such as authUrlAuthUrl:auth_urlauth_url or authCallbackAuthCallbackauth_callback:auth_callback. Read more about [Token authentication](/docs/platform/auth/token) | `String`, `TokenDetails` or `TokenRequest` | ### TokenDetails ObjectARTTokenDetailsio.ably.lib.types.TokenDetailsAbly::Models::TokenDetails @@ -902,8 +902,8 @@ try { | tokenToken | The [Ably Token](/docs/api/realtime-sdk/authentication#token-details) itself. A typical [Ably Token](/docs/api/realtime-sdk/authentication#token-details) string may appear like `{{TOKEN}}` | `String` | | expiresExpires | The time (in milliseconds since the epoch)The time at which this token expires | `Integer``Long Integer``DateTimeOffset``Time``NSDate` | | issuedIssued | The time (in milliseconds since the epoch)The time at which this token was issued | `Integer``Long Integer``DateTimeOffset``Time``NSDate` | -| capabilityCapability | The capability associated with this [Ably Token](/docs/api/realtime-sdk/authentication#token-details). The capability is a a JSON stringified canonicalized representation of the resource paths and associated operations. [Read more about authentication and capabilities](/docs/auth/capabilities) | `String``Capability` | -| clientIdclient_idClientId | The client ID, if any, bound to this [Ably Token](/docs/api/realtime-sdk/authentication#token-details). If a client ID is included, then the [Ably Token](/docs/api/realtime-sdk/authentication#token-details) authenticates its bearer as that client ID, and the [Ably Token](/docs/api/realtime-sdk/authentication#token-details) may only be used to perform operations on behalf of that client ID. The client is then considered to be an [identified client](/docs/auth/identified-clients) | `String` | +| capabilityCapability | The capability associated with this [Ably Token](/docs/api/realtime-sdk/authentication#token-details). The capability is a a JSON stringified canonicalized representation of the resource paths and associated operations. [Read more about authentication and capabilities](/docs/platform/auth/capabilities) | `String``Capability` | +| clientIdclient_idClientId | The client ID, if any, bound to this [Ably Token](/docs/api/realtime-sdk/authentication#token-details). If a client ID is included, then the [Ably Token](/docs/api/realtime-sdk/authentication#token-details) authenticates its bearer as that client ID, and the [Ably Token](/docs/api/realtime-sdk/authentication#token-details) may only be used to perform operations on behalf of that client ID. The client is then considered to be an [identified client](/docs/platform/auth/identified-clients) | `String` | ### Methods @@ -959,35 +959,35 @@ A [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) object ### TokenParams ObjectARTTokenParamsTokenParams Hashio.ably.lib.rest.Auth.TokenParams -`TokenParams` is a plain JavaScript object and is used in the parameters of [token authentication](/docs/auth/token) requests, corresponding to the desired attributes of the [Ably Token](/docs/api/realtime-sdk/authentication#token-details). The following attributes can be defined on the object: +`TokenParams` is a plain JavaScript object and is used in the parameters of [token authentication](/docs/platform/auth/token) requests, corresponding to the desired attributes of the [Ably Token](/docs/api/realtime-sdk/authentication#token-details). The following attributes can be defined on the object: -`TokenParams` is a Hash object and is used in the parameters of [token authentication](/docs/auth/token) requests, corresponding to the desired attributes of the [Ably Token](/docs/api/realtime-sdk/authentication#token-details). The following key symbol values can be added to the Hash: +`TokenParams` is a Hash object and is used in the parameters of [token authentication](/docs/platform/auth/token) requests, corresponding to the desired attributes of the [Ably Token](/docs/api/realtime-sdk/authentication#token-details). The following key symbol values can be added to the Hash: -`TokenParams` is a Dict and is used in the parameters of [token authentication](/docs/auth/token) requests, corresponding to the desired attributes of the [Ably Token](/docs/api/realtime-sdk/authentication#token-details). The following keys-value pairs can be added to the Dict: +`TokenParams` is a Dict and is used in the parameters of [token authentication](/docs/platform/auth/token) requests, corresponding to the desired attributes of the [Ably Token](/docs/api/realtime-sdk/authentication#token-details). The following keys-value pairs can be added to the Dict: -`TokenParams` is an Associative Array and is used in the parameters of [token authentication](/docs/auth/token) requests, corresponding to the desired attributes of the [Ably Token](/docs/api/realtime-sdk/authentication#token-details). The following named keys and values can be added to the Associative Array: +`TokenParams` is an Associative Array and is used in the parameters of [token authentication](/docs/platform/auth/token) requests, corresponding to the desired attributes of the [Ably Token](/docs/api/realtime-sdk/authentication#token-details). The following named keys and values can be added to the Associative Array: -`TokenParams` is used in the parameters of [token authentication](/docs/auth/token) requests, corresponding to the desired attributes of the [Ably Token](/docs/api/realtime-sdk/authentication#token-details). +`TokenParams` is used in the parameters of [token authentication](/docs/platform/auth/token) requests, corresponding to the desired attributes of the [Ably Token](/docs/api/realtime-sdk/authentication#token-details). -`ARTTokenParams` is used in the parameters of [token authentication](/docs/auth/token) requests, corresponding to the desired attributes of the [Ably Token](/docs/api/realtime-sdk/authentication#token-details). +`ARTTokenParams` is used in the parameters of [token authentication](/docs/platform/auth/token) requests, corresponding to the desired attributes of the [Ably Token](/docs/api/realtime-sdk/authentication#token-details). #### PropertiesMembersAttributes | Name | Description | Type | |------|-------------|------| -| capabilityCapability:capability | JSON stringified capability of the [Ably Token](/docs/api/realtime-sdk/authentication#token-details). If the [Ably Token](/docs/api/realtime-sdk/authentication#token-details) request is successful, the capability of the returned [Ably Token](/docs/api/realtime-sdk/authentication#token-details) will be the intersection of this capability with the capability of the issuing key. [Find our more about how to use capabilities to manage access privileges for clients](/docs/auth/capabilities). | `String``Capability` | -| clientIdClientIdclient_id:client_id | A client ID, used for identifying this client when publishing messages or for presence purposes. The clientIdclient_idClientId can be any non-empty string. This option is primarily intended to be used in situations where the library is instantiated with a key; note that a clientIdclient_idClientId may also be implicit in a token used to instantiate the library; an error will be raised if a clientIdclient_idClientId specified here conflicts with the clientIdclient_idClientId implicit in the token. [Find out more about client identities](/docs/auth/identified-clients) | `String` | +| capabilityCapability:capability | JSON stringified capability of the [Ably Token](/docs/api/realtime-sdk/authentication#token-details). If the [Ably Token](/docs/api/realtime-sdk/authentication#token-details) request is successful, the capability of the returned [Ably Token](/docs/api/realtime-sdk/authentication#token-details) will be the intersection of this capability with the capability of the issuing key. [Find our more about how to use capabilities to manage access privileges for clients](/docs/platform/auth/capabilities). | `String``Capability` | +| clientIdClientIdclient_id:client_id | A client ID, used for identifying this client when publishing messages or for presence purposes. The clientIdclient_idClientId can be any non-empty string. This option is primarily intended to be used in situations where the library is instantiated with a key; note that a clientIdclient_idClientId may also be implicit in a token used to instantiate the library; an error will be raised if a clientIdclient_idClientId specified here conflicts with the clientIdclient_idClientId implicit in the token. [Find out more about client identities](/docs/platform/auth/identified-clients) | `String` | | nonceNonce:nonce | An optional opaque nonce string of at least 16 characters to ensure uniqueness of this request. Any subsequent request using the same nonce will be rejected. | `String` | | timestampTimestamp:timestamp | The timestamp (in milliseconds since the epoch)The timestamp of this request. `timestamp`, in conjunction with the `nonce`, is used to prevent requests for [Ably Token](/docs/api/realtime-sdk/authentication#token-details) from being replayed. | `Integer``Long Integer``Time``NSDate``DateTimeOffset` | | ttlTtl:ttl | _1 hour_ Requested time to live for the [Ably Token](/docs/api/realtime-sdk/authentication#token-details) being created in millisecondsin secondsas a `NSTimeInterval`as a `TimeSpan`. When omitted, the Ably REST API default of 60 minutes is applied by Ably | `Integer` (milliseconds)`Integer` (seconds)`NSTimeInterval``Long Integer``TimeSpan` | @@ -1003,7 +1003,7 @@ A [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) object | keyNamekey_nameKeyName | The key name of the key against which this request is made. The key name is public, whereas the key secret is private | `String` | | ttlTtl | Requested time to live for the [Ably Token](/docs/api/realtime-sdk/authentication#token-details) in millisecondsin secondsas a `TimeSpan`. If the Ably `TokenRequest` is successful, the TTL of the returned [Ably Token](/docs/api/realtime-sdk/authentication#token-details) will be less than or equal to this value depending on application settings and the attributes of the issuing key. | `Integer``TimeSpan``NSTimeInterval``Integer` | | timestampTimestamp | The timestamp of this request in milliseconds | `Integer``Long Integer``Time``DateTimeOffset``NSDate` | -| capabilityCapability | Capability of the requested [Ably Token](/docs/api/realtime-sdk/authentication#token-details). If the Ably `TokenRequest` is successful, the capability of the returned [Ably Token](/docs/api/realtime-sdk/authentication#token-details) will be the intersection of this capability with the capability of the issuing key. The capability is a JSON stringified canonicalized representation of the resource paths and associated operations. [Read more about authentication and capabilities](/docs/auth) | `String` | +| capabilityCapability | Capability of the requested [Ably Token](/docs/api/realtime-sdk/authentication#token-details). If the Ably `TokenRequest` is successful, the capability of the returned [Ably Token](/docs/api/realtime-sdk/authentication#token-details) will be the intersection of this capability with the capability of the issuing key. The capability is a JSON stringified canonicalized representation of the resource paths and associated operations. [Read more about authentication and capabilities](/docs/platform/auth) | `String` | | clientIdclient_idClientId | The client ID to associate with the requested [Ably Token](/docs/api/realtime-sdk/authentication#token-details). When provided, the [Ably Token](/docs/api/realtime-sdk/authentication#token-details) may only be used to perform operations on behalf of that client ID | `String` | | nonceNonce | An opaque nonce string of at least 16 characters | `String` | | macMac | The Message Authentication Code for this request | `String` | @@ -1047,7 +1047,7 @@ An Ably JWT is not strictly an Ably construct, rather it is a [JWT](https://jwt. Arbitrary additional claims and headers are supported (apart from those prefixed with `x-ably-` which are reserved for future use). -The Ably JWT must be signed with the secret part of your [Ably API key](/docs/auth#api-key) using the signature algorithm HS256 (HMAC using the SHA-256 hash algorithm). View the [JSON Web Algorithms (JWA) specification](https://tools.ietf.org/html/rfc7518) for further information. +The Ably JWT must be signed with the secret part of your [Ably API key](/docs/platform/auth#api-key) using the signature algorithm HS256 (HMAC using the SHA-256 hash algorithm). View the [JSON Web Algorithms (JWA) specification](https://tools.ietf.org/html/rfc7518) for further information. We recommend you use one of the many [JWT libraries available for simplicity](https://jwt.io/) when creating your JWTs. diff --git a/src/pages/docs/api/rest-sdk/channels.mdx b/src/pages/docs/api/rest-sdk/channels.mdx index 022178675c..c7b498af0d 100644 --- a/src/pages/docs/api/rest-sdk/channels.mdx +++ b/src/pages/docs/api/rest-sdk/channels.mdx @@ -471,7 +471,7 @@ On failure to retrieve message history, the `error` contains an [`ErrorInfo`](#e `getMessage(serialOrMessage: string | Message): Promise` -Retrieves the latest version of a specific message by its serial identifier. Requires the **history** [capability](/docs/auth/capabilities). +Retrieves the latest version of a specific message by its serial identifier. Requires the **history** [capability](/docs/platform/auth/capabilities). See [updating and deleting messages: retrieving the latest version](/docs/messages/updates-deletes#get) for more information. @@ -551,7 +551,7 @@ Returns a promise which, upon success, will be fulfilled with an [`UpdateDeleteR `getMessageVersions(serialOrMessage: string | Message, params?: Record): Promise>` -Retrieves all historical versions of a specific message, ordered by version. This includes the original message and all subsequent updates or delete operations. Requires the **history** [capability](/docs/auth/capabilities). +Retrieves all historical versions of a specific message, ordered by version. This includes the original message and all subsequent updates or delete operations. Requires the **history** [capability](/docs/platform/auth/capabilities). See [updating and deleting messages: versions](/docs/messages/updates-deletes#versions) for more information. diff --git a/src/pages/docs/api/rest-sdk/push-admin.mdx b/src/pages/docs/api/rest-sdk/push-admin.mdx index 097fb57e21..116dfa392f 100644 --- a/src/pages/docs/api/rest-sdk/push-admin.mdx +++ b/src/pages/docs/api/rest-sdk/push-admin.mdx @@ -29,7 +29,7 @@ The returned [`DeviceRegistrations`](#device-registrations-object) object provid #### channelSubscriptionschannel_subscriptions -The returned [`PushChannelSubscriptions`](#push-channel-subscriptions) object provides functionality for subscribing, listing and unsubscribing individual devices or groups of [identified devices](/docs/auth/identified-clients) to push notifications published on channels. +The returned [`PushChannelSubscriptions`](#push-channel-subscriptions) object provides functionality for subscribing, listing and unsubscribing individual devices or groups of [identified devices](/docs/platform/auth/identified-clients) to push notifications published on channels. ### Methods @@ -65,7 +65,7 @@ The returned [`PushChannelSubscriptions`](#push-channel-subscriptions) object pr -Publishes a push notification directly to a device or group of devices sharing a [client identifier](/docs/auth/identified-clients). See the [push notification direct publishing documentation](/docs/push/publish#direct-publishing) for more information. +Publishes a push notification directly to a device or group of devices sharing a [client identifier](/docs/platform/auth/identified-clients). See the [push notification direct publishing documentation](/docs/push/publish#direct-publishing) for more information. ##### Parameters @@ -692,7 +692,7 @@ This object is accessible through clientIdclient_id | optional trusted [client identifier](/docs/auth/identified-clients) for the device | String | +| clientIdclient_id | optional trusted [client identifier](/docs/platform/auth/identified-clients) for the device | String | | formFactorform_factor | form factor of the push device. Must be one of `phone`, `tablet`, `desktop`, `tv`, `watch`, `car` or `embedded`or `other` | String | | metadata | optional metadata object for this device. The metadata for a device may only be set by clients with `push-admin` privileges | ObjectArrayHash | | platform | platform of the push device. Must be one of `ios` or `android`or `browser` | String | @@ -1210,7 +1210,7 @@ Failure to retrieve the message history will raise an [`AblyException`](/docs/ap ### PushChannelSubscriptionAbly::Models::PushChannelSubscriptionChannelSubscriptionARTPushChannelSubscription -An `PushChannelSubscription` is a type encapsulating the subscription of a device or group of devices sharing a [client identifier](/docs/auth/identified-clients) to a channel in order to receive push notifications. +An `PushChannelSubscription` is a type encapsulating the subscription of a device or group of devices sharing a [client identifier](/docs/platform/auth/identified-clients) to a channel in order to receive push notifications. #### PropertiesAttributes @@ -1218,7 +1218,7 @@ An `PushChannelSubscription` is a type encapsulating the subscription of a devic |----------|-------------|------| | channel | the channel that this push notification subscription is associated with | String | | deviceIddevice_id | the device with this identifier is linked to this channel subscription. When present, `clientId``client_id` is never present | String | -| clientIdclient_id | devices with this [client identifier](/docs/auth/identified-clients) are included in this channel subscription. When present, `deviceId``device_id` is never present | String | +| clientIdclient_id | devices with this [client identifier](/docs/platform/auth/identified-clients) are included in this channel subscription. When present, `deviceId``device_id` is never present | String | @@ -1265,14 +1265,14 @@ A [`PushChannelSubscription`](/docs/api/realtime-sdk/types#push-channel-subscrip -A static factory method to create a `PushChannelSubscription` object for a channel and group of devices sharing a [client identifier](/docs/auth/identified-clients). +A static factory method to create a `PushChannelSubscription` object for a channel and group of devices sharing a [client identifier](/docs/platform/auth/identified-clients). ##### Parameters | Parameter | Description | Type | |-----------|-------------|------| | channel | channel name linked to this push channel subscription | String | -| clientIdclient_id | devices with this [client identifier](/docs/auth/identified-clients) are included in the new push channel subscription | String | +| clientIdclient_id | devices with this [client identifier](/docs/platform/auth/identified-clients) are included in the new push channel subscription | String | ##### Returns diff --git a/src/pages/docs/api/rest-sdk/types.mdx b/src/pages/docs/api/rest-sdk/types.mdx index 646ef6c8f3..ac85e8d02c 100644 --- a/src/pages/docs/api/rest-sdk/types.mdx +++ b/src/pages/docs/api/rest-sdk/types.mdx @@ -1353,8 +1353,8 @@ Please note that `key` and `value` attributes are always strings. If an `Integer | tokenToken | The [Ably Token](/docs/api/realtime-sdk/authentication#token-details) itself. A typical [Ably Token](/docs/api/realtime-sdk/authentication#token-details) string may appear like `{{TOKEN}}` | `String` | | expiresExpires | The time (in milliseconds since the epoch)The time at which this token expires | `Integer``Long Integer``DateTimeOffset``Time``NSDate` | | issuedIssued | The time (in milliseconds since the epoch)The time at which this token was issued | `Integer``Long Integer``DateTimeOffset``Time``NSDate` | -| capabilityCapability | The capability associated with this [Ably Token](/docs/api/realtime-sdk/authentication#token-details). The capability is a a JSON stringified canonicalized representation of the resource paths and associated operations. [Read more about authentication and capabilities](/docs/auth/capabilities) | `String``Capability` | -| clientIdclient_idClientId | The client ID, if any, bound to this [Ably Token](/docs/api/realtime-sdk/authentication#token-details). If a client ID is included, then the [Ably Token](/docs/api/realtime-sdk/authentication#token-details) authenticates its bearer as that client ID, and the [Ably Token](/docs/api/realtime-sdk/authentication#token-details) may only be used to perform operations on behalf of that client ID. The client is then considered to be an [identified client](/docs/auth/identified-clients) | `String` | +| capabilityCapability | The capability associated with this [Ably Token](/docs/api/realtime-sdk/authentication#token-details). The capability is a a JSON stringified canonicalized representation of the resource paths and associated operations. [Read more about authentication and capabilities](/docs/platform/auth/capabilities) | `String``Capability` | +| clientIdclient_idClientId | The client ID, if any, bound to this [Ably Token](/docs/api/realtime-sdk/authentication#token-details). If a client ID is included, then the [Ably Token](/docs/api/realtime-sdk/authentication#token-details) authenticates its bearer as that client ID, and the [Ably Token](/docs/api/realtime-sdk/authentication#token-details) may only be used to perform operations on behalf of that client ID. The client is then considered to be an [identified client](/docs/platform/auth/identified-clients) | `String` | @@ -1438,7 +1438,7 @@ A [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) object | keyNamekey_nameKeyName | The key name of the key against which this request is made. The key name is public, whereas the key secret is private | `String` | | ttlTtl | Requested time to live for the [Ably Token](/docs/api/realtime-sdk/authentication#token-details) in millisecondsin secondsas a `TimeSpan`. If the Ably `TokenRequest` is successful, the TTL of the returned [Ably Token](/docs/api/realtime-sdk/authentication#token-details) will be less than or equal to this value depending on application settings and the attributes of the issuing key. | `Integer``TimeSpan``NSTimeInterval` | | timestampTimestamp | The timestamp of this request in milliseconds | `Integer``Long Integer``Time``DateTimeOffset``NSDate` | -| capabilityCapability | Capability of the requested [Ably Token](/docs/api/realtime-sdk/authentication#token-details). If the Ably `TokenRequest` is successful, the capability of the returned [Ably Token](/docs/api/realtime-sdk/authentication#token-details) will be the intersection of this capability with the capability of the issuing key. The capability is a JSON stringified canonicalized representation of the resource paths and associated operations. [Read more about authentication and capabilities](/docs/auth) | `String` | +| capabilityCapability | Capability of the requested [Ably Token](/docs/api/realtime-sdk/authentication#token-details). If the Ably `TokenRequest` is successful, the capability of the returned [Ably Token](/docs/api/realtime-sdk/authentication#token-details) will be the intersection of this capability with the capability of the issuing key. The capability is a JSON stringified canonicalized representation of the resource paths and associated operations. [Read more about authentication and capabilities](/docs/platform/auth) | `String` | | clientIdclient_idClientId | The client ID to associate with the requested [Ably Token](/docs/api/realtime-sdk/authentication#token-details). When provided, the [Ably Token](/docs/api/realtime-sdk/authentication#token-details) may only be used to perform operations on behalf of that client ID | `String` | | nonceNonce | An opaque nonce string of at least 16 characters | `String` | | macMac | The Message Authentication Code for this request | `String` | @@ -1772,27 +1772,27 @@ A `TokenRevocationFailureResult` contains information about the result of an uns -`AuthOptions` is a plain JavaScript object and is used when making [authentication](/docs/auth) requests. If passed in, an `authOptions` object will be used instead of (as opposed to supplementing or being merged with) the default values given when the library was instantiated. The following attributes are supported: +`AuthOptions` is a plain JavaScript object and is used when making [authentication](/docs/platform/auth) requests. If passed in, an `authOptions` object will be used instead of (as opposed to supplementing or being merged with) the default values given when the library was instantiated. The following attributes are supported: -`AuthOptions` is a Hash object and is used when making [authentication](/docs/auth) requests. These options will supplement or override the corresponding options given when the library was instantiated. The following key symbol values can be added to the Hash: +`AuthOptions` is a Hash object and is used when making [authentication](/docs/platform/auth) requests. These options will supplement or override the corresponding options given when the library was instantiated. The following key symbol values can be added to the Hash: -`AuthOptions` is a Dict and is used when making [authentication](/docs/auth) requests. These options will supplement or override the corresponding options given when the library was instantiated. The following key symbol values can be added to the Dict: +`AuthOptions` is a Dict and is used when making [authentication](/docs/platform/auth) requests. These options will supplement or override the corresponding options given when the library was instantiated. The following key symbol values can be added to the Dict: -`AuthOptions` is an Associative Array and is used when making [authentication](/docs/auth) requests. These options will supplement or override the corresponding options given when the library was instantiated. The following named keys and values can be added to the Associative Array: +`AuthOptions` is an Associative Array and is used when making [authentication](/docs/platform/auth) requests. These options will supplement or override the corresponding options given when the library was instantiated. The following named keys and values can be added to the Associative Array: -`ART``AuthOptions` is used when making [authentication](/docs/auth) requests. These options will supplement or override the corresponding options given when the library was instantiated. +`ART``AuthOptions` is used when making [authentication](/docs/platform/auth) requests. These options will supplement or override the corresponding options given when the library was instantiated. @@ -1800,15 +1800,15 @@ A `TokenRevocationFailureResult` contains information about the result of an uns | Parameter | Description | Type | |-----------|-------------|------| -| authCallbackAuthCallbackauth_callback:auth_callback | A functionfunction with the form `function(tokenParams, callback(err, tokenOrTokenRequest))``TokenCallback` instancecallable (eg a lambda)proc / lambda (called synchronously in REST and Realtime but does not block EventMachine in the latter) which is called when a new token is required. The role of the callback is to obtain a fresh token, one of: an Ably Token string (in plain text format); a signed [`TokenRequest`](/docs/api/realtime-sdk/types#token-request); a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) (in JSON format); an [Ably JWT](/docs/api/realtime-sdk/authentication#ably-jwt). See [our authentication documentation](/docs/auth) for details of the Ably TokenRequest format and associated API calls. | `Callable``TokenCallback``Proc``Func>``Callable` | +| authCallbackAuthCallbackauth_callback:auth_callback | A functionfunction with the form `function(tokenParams, callback(err, tokenOrTokenRequest))``TokenCallback` instancecallable (eg a lambda)proc / lambda (called synchronously in REST and Realtime but does not block EventMachine in the latter) which is called when a new token is required. The role of the callback is to obtain a fresh token, one of: an Ably Token string (in plain text format); a signed [`TokenRequest`](/docs/api/realtime-sdk/types#token-request); a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) (in JSON format); an [Ably JWT](/docs/api/realtime-sdk/authentication#ably-jwt). See [our authentication documentation](/docs/platform/auth) for details of the Ably TokenRequest format and associated API calls. | `Callable``TokenCallback``Proc``Func>``Callable` | | authUrlAuthUrl:auth_urlauth_url | A URL that the library may use to obtain a fresh token, one of: an Ably Token string (in plain text format); a signed [`TokenRequest`](/docs/api/realtime-sdk/types#token-request); a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) (in JSON format); an [Ably JWT](/docs/api/realtime-sdk/authentication#ably-jwt). For example, this can be used by a client to obtain signed Ably TokenRequests from an application server. | `String``Uri``NSURL` | | authMethodAuthMethodauth_method:auth_method | The HTTP verb to use for the request, either `GET``:get` or `POST``:post`. The default is `GET``:get`. | `String``Symbol``HttpMethod` | | authHeadersAuthHeadersauth_headers:auth_headers | A set of key value pair headers to be added to any request made to the `authUrl``AuthUrl`. Useful when an application requires these to be added to validate the request or implement the response. If the `authHeaders` object contains an `authorization` key, then `withCredentials` will be set on the xhr request. | `Object``Dict``Hash`Associative Array`Param []``Dictionary``Map``Object` | | authParamsAuthParams:auth_paramsauth_params | A set of key value pair params to be added to any request made to the `authUrl``AuthUrl`. When the `authMethod``AuthMethod` is `GET`, query params are added to the URL, whereas when `authMethod``AuthMethod` is `POST`, the params are sent as URL encoded form data. Useful when an application require these to be added to validate the request or implement the response. | `Object``Hash`Associative Array`Param[]``Dictionary``NSArray``[NSURLQueryItem]/Array``Map``Object``Object` | -| tokenDetailsTokenDetailstoken_details:token_details | An authenticated [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) object (most commonly obtained from an Ably Token Request response). This option is mostly useful for testing: since tokens are short-lived, in production you almost always want to use an authentication method that allows the client library to renew the token automatically when the previous one expires, such as `authUrl``AuthUrl``:auth_url``auth_url` or `authCallback``AuthCallback``auth_callback``:auth_callback`. Use this option if you wish to use Token authentication. Read more about [Token authentication](/docs/auth/token) | `TokenDetails` | -| keyKey:keykey | Optionally the [API key](/docs/auth#api-key) to use can be specified as a full key string; if not, the API key passed into [`ClientOptions`](#client-options) when instancing the Realtime or REST library is used | `String` | -| queryTimeQueryTime:query_timequery_time | If true, the library will query the Ably servers for the current time when [issuing TokenRequests](/docs/auth/token) instead of relying on a locally-available time of day. Knowing the time accurately is needed to create valid signed Ably [TokenRequests](/docs/auth/token), so this option is useful for library instances on auth servers where for some reason the server clock cannot be kept synchronized through normal means, such as an [NTP daemon](https://en.wikipedia.org/wiki/Ntpd). The server is queried for the current time once per client library instance (which stores the offset from the local clock), so if using this option you should avoid instancing a new version of the library for each request. The default is false. | `Boolean` | -| tokenToken:tokentoken | An authenticated token. This can either be a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) object, a [`TokenRequest`](/docs/api/realtime-sdk/types#token-request) object, or token string (obtained from the `token``Token` property of a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) component of an Ably TokenRequest response, or a [JSON Web Token](https://tools.ietf.org/html/rfc7519) satisfying [the Ably requirements for JWTs](/docs/auth/token#jwt)). This option is mostly useful for testing: since tokens are short-lived, in production you almost always want to use an authentication method that allows the client library to renew the token automatically when the previous one expires, such as `authUrl``AuthUrl``:auth_url``auth_url` or `authCallback``AuthCallback``auth_callback``:auth_callback`. Read more about [Token authentication](/docs/auth/token) | `String`, `TokenDetails` or `TokenRequest` | +| tokenDetailsTokenDetailstoken_details:token_details | An authenticated [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) object (most commonly obtained from an Ably Token Request response). This option is mostly useful for testing: since tokens are short-lived, in production you almost always want to use an authentication method that allows the client library to renew the token automatically when the previous one expires, such as `authUrl``AuthUrl``:auth_url``auth_url` or `authCallback``AuthCallback``auth_callback``:auth_callback`. Use this option if you wish to use Token authentication. Read more about [Token authentication](/docs/platform/auth/token) | `TokenDetails` | +| keyKey:keykey | Optionally the [API key](/docs/platform/auth#api-key) to use can be specified as a full key string; if not, the API key passed into [`ClientOptions`](#client-options) when instancing the Realtime or REST library is used | `String` | +| queryTimeQueryTime:query_timequery_time | If true, the library will query the Ably servers for the current time when [issuing TokenRequests](/docs/platform/auth/token) instead of relying on a locally-available time of day. Knowing the time accurately is needed to create valid signed Ably [TokenRequests](/docs/platform/auth/token), so this option is useful for library instances on auth servers where for some reason the server clock cannot be kept synchronized through normal means, such as an [NTP daemon](https://en.wikipedia.org/wiki/Ntpd). The server is queried for the current time once per client library instance (which stores the offset from the local clock), so if using this option you should avoid instancing a new version of the library for each request. The default is false. | `Boolean` | +| tokenToken:tokentoken | An authenticated token. This can either be a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) object, a [`TokenRequest`](/docs/api/realtime-sdk/types#token-request) object, or token string (obtained from the `token``Token` property of a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) component of an Ably TokenRequest response, or a [JSON Web Token](https://tools.ietf.org/html/rfc7519) satisfying [the Ably requirements for JWTs](/docs/platform/auth/token#jwt)). This option is mostly useful for testing: since tokens are short-lived, in production you almost always want to use an authentication method that allows the client library to renew the token automatically when the previous one expires, such as `authUrl``AuthUrl``:auth_url``auth_url` or `authCallback``AuthCallback``auth_callback``:auth_callback`. Read more about [Token authentication](/docs/platform/auth/token) | `String`, `TokenDetails` or `TokenRequest` | ### ClientOptions ObjectARTClientOptionsClientOptions HashClientOptions Arrayio.ably.types.ClientOptionsIO.Ably.ClientOptions @@ -1845,17 +1845,17 @@ A `TokenRevocationFailureResult` contains information about the result of an uns | Parameter | Description | Type | |-----------|-------------|------| -| key | The full key string, as obtained from the [application dashboard](https://ably.com/dashboard). Use this option if you wish to use Basic authentication, or wish to be able to issue Ably Tokens without needing to defer to a separate entity to sign Ably TokenRequests. Read more about [Basic authentication](/docs/auth/basic) | `String` | -| token | An authenticated token. This can either be a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) object, a [`TokenRequest`](/docs/api/realtime-sdk/types#token-request) object, or token string (obtained from the `token` property of a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) component of an Ably TokenRequest response, or a [JSON Web Token](https://tools.ietf.org/html/rfc7519) satisfying [the Ably requirements for JWTs](/docs/auth/token#jwt)). This option is mostly useful for testing: since tokens are short-lived, in production you almost always want to use an authentication method that allows the client library to renew the token automatically when the previous one expires, such as `authUrl` or `authCallback`. Read more about [Token authentication](/docs/auth/token) | `String`, `TokenDetails` or `TokenRequest` | -| authCallback | A functionfunction with the form `function(tokenParams, callback(err, tokenOrTokenRequest))` which is called when a new token is required. The role of the callback is to obtain a fresh token, one of: an Ably Token string (in plain text format); a signed [`TokenRequest`](/docs/api/realtime-sdk/types#token-request); a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) (in JSON format); an [Ably JWT](/docs/api/realtime-sdk/authentication#ably-jwt). See [our authentication documentation](/docs/auth) for details of the Ably TokenRequest format and associated API calls. | `Callable` | +| key | The full key string, as obtained from the [application dashboard](https://ably.com/dashboard). Use this option if you wish to use Basic authentication, or wish to be able to issue Ably Tokens without needing to defer to a separate entity to sign Ably TokenRequests. Read more about [Basic authentication](/docs/platform/auth/basic) | `String` | +| token | An authenticated token. This can either be a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) object, a [`TokenRequest`](/docs/api/realtime-sdk/types#token-request) object, or token string (obtained from the `token` property of a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) component of an Ably TokenRequest response, or a [JSON Web Token](https://tools.ietf.org/html/rfc7519) satisfying [the Ably requirements for JWTs](/docs/platform/auth/token#jwt)). This option is mostly useful for testing: since tokens are short-lived, in production you almost always want to use an authentication method that allows the client library to renew the token automatically when the previous one expires, such as `authUrl` or `authCallback`. Read more about [Token authentication](/docs/platform/auth/token) | `String`, `TokenDetails` or `TokenRequest` | +| authCallback | A functionfunction with the form `function(tokenParams, callback(err, tokenOrTokenRequest))` which is called when a new token is required. The role of the callback is to obtain a fresh token, one of: an Ably Token string (in plain text format); a signed [`TokenRequest`](/docs/api/realtime-sdk/types#token-request); a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) (in JSON format); an [Ably JWT](/docs/api/realtime-sdk/authentication#ably-jwt). See [our authentication documentation](/docs/platform/auth) for details of the Ably TokenRequest format and associated API calls. | `Callable` | | authUrl | A URL that the library may use to obtain a fresh token, one of: an Ably Token string (in plain text format); a signed [`TokenRequest`](/docs/api/realtime-sdk/types#token-request); a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) (in JSON format); an [Ably JWT](/docs/api/realtime-sdk/authentication#ably-jwt). For example, this can be used by a client to obtain signed Ably TokenRequests from an application server. | `String` | | authMethod | The HTTP verb to use for the request, either `GET` or `POST`. The default is `GET`. | `String` | | authHeaders | A set of key value pair headers to be added to any request made to the `authUrl`. Useful when an application requires these to be added to validate the request or implement the response. If the `authHeaders` object contains an `authorization` key, then `withCredentials` will be set on the xhr request. | `Object` | | authParams | A set of key value pair params to be added to any request made to the `authUrl`. When the `authMethod` is `GET`, query params are added to the URL, whereas when `authMethod` is `POST`, the params are sent as URL encoded form data. Useful when an application require these to be added to validate the request or implement the response. | `Object` | -| tokenDetails | An authenticated [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) object (most commonly obtained from an Ably Token Request response). This option is mostly useful for testing: since tokens are short-lived, in production you almost always want to use an authentication method that allows the client library to renew the token automatically when the previous one expires, such as `authUrl` or `authCallback`. Use this option if you wish to use Token authentication. Read more about [Token authentication](/docs/auth/token) | `TokenDetails` | +| tokenDetails | An authenticated [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) object (most commonly obtained from an Ably Token Request response). This option is mostly useful for testing: since tokens are short-lived, in production you almost always want to use an authentication method that allows the client library to renew the token automatically when the previous one expires, such as `authUrl` or `authCallback`. Use this option if you wish to use Token authentication. Read more about [Token authentication](/docs/platform/auth/token) | `TokenDetails` | | tls | A boolean value, indicating whether or not a TLS ("SSL") secure connection should be used. An insecure connection cannot be used with Basic authentication as it would lead to a possible compromise of the private API key while in transit. [Find out more about TLS](https://faqs.ably.com/are-messages-sent-to-and-received-from-ably-securely-using-tls). The default is true. | `Boolean` | -| clientId | A client ID, used for identifying this client when publishing messages or for presence purposes. The `clientId` can be any non-empty string. This option is primarily intended to be used in situations where the library is instantiated with a key; note that a `clientId` may also be implicit in a token used to instantiate the library; an error will be raised if a `clientId` specified here conflicts with the `clientId` implicit in the token. [Find out more about client identities](/docs/auth/identified-clients) | `String` | -| useTokenAuth | When true, forces [Token authentication](/docs/auth/token) to be used by the library. Please note that if a `clientId` is not specified in the [`ClientOptions`](/docs/api/realtime-sdk/types#client-options) or [`TokenParams`](/docs/api/realtime-sdk/types#token-params), then the Ably Token issued will be [anonymous](https://faqs.ably.com/authenticated-and-identified-clients). The default is false. | `Boolean` | +| clientId | A client ID, used for identifying this client when publishing messages or for presence purposes. The `clientId` can be any non-empty string. This option is primarily intended to be used in situations where the library is instantiated with a key; note that a `clientId` may also be implicit in a token used to instantiate the library; an error will be raised if a `clientId` specified here conflicts with the `clientId` implicit in the token. [Find out more about client identities](/docs/platform/auth/identified-clients) | `String` | +| useTokenAuth | When true, forces [Token authentication](/docs/platform/auth/token) to be used by the library. Please note that if a `clientId` is not specified in the [`ClientOptions`](/docs/api/realtime-sdk/types#client-options) or [`TokenParams`](/docs/api/realtime-sdk/types#token-params), then the Ably Token issued will be [anonymous](https://faqs.ably.com/authenticated-and-identified-clients). The default is false. | `Boolean` | | endpoint | Enables [enterprise customers](https://ably.com/pricing) to use their own custom endpoints, which support dedicated, isolated clusters and regional message routing and storage constraints. See our [platform customization guide](/docs/platform/account/enterprise-customization) for more details. The default is null. | `String` | | environment | Deprecated, use `endpoint`. Enables [enterprise customers](https://ably.com/pricing) to use their own custom environments, which support dedicated, isolated clusters and regional message routing and storage constraints. See our [platform customization guide](/docs/platform/account/enterprise-customization) for more details. The default is null. | `String` | | idempotentRestPublishing | When true, enables idempotent publishing by assigning a unique message ID client-side, allowing the Ably servers to discard automatic publish retries following a failure such as a network fault. We recommend you enable this by default. In version 1.2 onwards, idempotent publishing for retries will be enabled by default. The default is false. | `Boolean` | @@ -1865,7 +1865,7 @@ A `TokenRevocationFailureResult` contains information about the result of an uns | logHandler | A function to handle each line of the library's log output. If `logHandler` is not specified, `console.log` is used. | `Callable` | | transports | An optional array of transports to use, in descending order of preference. In the browser environment the available transports are: `web_socket`, `xhr_polling`.The transports available in the Node.js client library are: `web_socket`, `xhr_polling`, `comet`. | `String []` | | useBinaryProtocol | If set to true, will enable the binary protocol (MessagePack) if it is supported. It's disabled by default on browsers for performance considerations (browsers are optimized for decoding JSON). The default is false.If set to false, will forcibly disable the binary protocol (MessagePack). The binary protocol is used by default unless it is not supported. The default is true. Find out more about the [benefits of binary encoding](https://faqs.ably.com/do-you-binary-encode-your-messages-for-greater-efficiency) | `Boolean` | -| queryTime | If true, the library will query the Ably servers for the current time when [issuing TokenRequests](/docs/auth/token) instead of relying on a locally-available time of day. Knowing the time accurately is needed to create valid signed Ably [TokenRequests](/docs/api/rest-sdk/authentication#token-request), so this option is useful for library instances on auth servers where for some reason the server clock cannot be kept synchronized through normal means, such as an [NTP daemon](https://en.wikipedia.org/wiki/Ntpd). The server is queried for the current time once per client library instance (which stores the offset from the local clock), so if using this option you should avoid instancing a new version of the library for each request. The default is false. | `Boolean` | +| queryTime | If true, the library will query the Ably servers for the current time when [issuing TokenRequests](/docs/platform/auth/token) instead of relying on a locally-available time of day. Knowing the time accurately is needed to create valid signed Ably [TokenRequests](/docs/api/rest-sdk/authentication#token-request), so this option is useful for library instances on auth servers where for some reason the server clock cannot be kept synchronized through normal means, such as an [NTP daemon](https://en.wikipedia.org/wiki/Ntpd). The server is queried for the current time once per client library instance (which stores the offset from the local clock), so if using this option you should avoid instancing a new version of the library for each request. The default is false. | `Boolean` | | defaultTokenParams | When a [TokenParams](/docs/api/rest-sdk/types#token-params) object is provided, it will override the client library defaults when issuing new [Ably Tokens](/docs/api/realtime-sdk/authentication#token-details) or [Ably TokenRequests](/docs/api/rest-sdk/authentication#token-request) | [`TokenParams`](/docs/api/rest-sdk/types#token-params) | @@ -1874,17 +1874,17 @@ A `TokenRevocationFailureResult` contains information about the result of an uns | Parameter | Description | Type | |-----------|-------------|------| -| key | The full key string, as obtained from the [application dashboard](https://ably.com/dashboard). Use this option if you wish to use Basic authentication, or wish to be able to issue Ably Tokens without needing to defer to a separate entity to sign Ably TokenRequests. Read more about [Basic authentication](/docs/auth/basic) | `String` | -| token | An authenticated token. This can either be a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) object, a [`TokenRequest`](/docs/api/realtime-sdk/types#token-request) object, or token string (obtained from the `token` property of a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) component of an Ably TokenRequest response, or a [JSON Web Token](https://tools.ietf.org/html/rfc7519) satisfying [the Ably requirements for JWTs](/docs/auth/token#jwt)). This option is mostly useful for testing: since tokens are short-lived, in production you almost always want to use an authentication method that allows the client library to renew the token automatically when the previous one expires, such as `authUrl` or `authCallback`. Read more about [Token authentication](/docs/auth/token) | `String`, `TokenDetails` or `TokenRequest` | -| authCallback | A `TokenCallback` instance which is called when a new token is required. The role of the callback is to obtain a fresh token, one of: an Ably Token string (in plain text format); a signed [`TokenRequest`](/docs/api/realtime-sdk/types#token-request); a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) (in JSON format); an [Ably JWT](/docs/api/realtime-sdk/authentication#ably-jwt). See [our authentication documentation](/docs/auth) for details of the Ably TokenRequest format and associated API calls. | `TokenCallback` | +| key | The full key string, as obtained from the [application dashboard](https://ably.com/dashboard). Use this option if you wish to use Basic authentication, or wish to be able to issue Ably Tokens without needing to defer to a separate entity to sign Ably TokenRequests. Read more about [Basic authentication](/docs/platform/auth/basic) | `String` | +| token | An authenticated token. This can either be a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) object, a [`TokenRequest`](/docs/api/realtime-sdk/types#token-request) object, or token string (obtained from the `token` property of a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) component of an Ably TokenRequest response, or a [JSON Web Token](https://tools.ietf.org/html/rfc7519) satisfying [the Ably requirements for JWTs](/docs/platform/auth/token#jwt)). This option is mostly useful for testing: since tokens are short-lived, in production you almost always want to use an authentication method that allows the client library to renew the token automatically when the previous one expires, such as `authUrl` or `authCallback`. Read more about [Token authentication](/docs/platform/auth/token) | `String`, `TokenDetails` or `TokenRequest` | +| authCallback | A `TokenCallback` instance which is called when a new token is required. The role of the callback is to obtain a fresh token, one of: an Ably Token string (in plain text format); a signed [`TokenRequest`](/docs/api/realtime-sdk/types#token-request); a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) (in JSON format); an [Ably JWT](/docs/api/realtime-sdk/authentication#ably-jwt). See [our authentication documentation](/docs/platform/auth) for details of the Ably TokenRequest format and associated API calls. | `TokenCallback` | | authUrl | A URL that the library may use to obtain a fresh token, one of: an Ably Token string (in plain text format); a signed [`TokenRequest`](/docs/api/realtime-sdk/types#token-request); a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) (in JSON format); an [Ably JWT](/docs/api/realtime-sdk/authentication#ably-jwt). For example, this can be used by a client to obtain signed Ably TokenRequests from an application server. | `String` | | authMethod | The HTTP verb to use for the request, either `GET` or `POST`. The default is `GET`. | `String` | | authHeaders | A set of key value pair headers to be added to any request made to the `authUrl`. Useful when an application requires these to be added to validate the request or implement the response. | `Param []` | | authParams | A set of key value pair params to be added to any request made to the `authUrl`. When the `authMethod` is `GET`, query params are added to the URL, whereas when `authMethod` is `POST`, the params are sent as URL encoded form data. Useful when an application require these to be added to validate the request or implement the response. | `Param[]` | -| tokenDetails | An authenticated [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) object (most commonly obtained from an Ably Token Request response). This option is mostly useful for testing: since tokens are short-lived, in production you almost always want to use an authentication method that allows the client library to renew the token automatically when the previous one expires, such as `authUrl` or `authCallback`. Use this option if you wish to use Token authentication. Read more about [Token authentication](/docs/auth/token) | `TokenDetails` | +| tokenDetails | An authenticated [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) object (most commonly obtained from an Ably Token Request response). This option is mostly useful for testing: since tokens are short-lived, in production you almost always want to use an authentication method that allows the client library to renew the token automatically when the previous one expires, such as `authUrl` or `authCallback`. Use this option if you wish to use Token authentication. Read more about [Token authentication](/docs/platform/auth/token) | `TokenDetails` | | tls | A boolean value, indicating whether or not a TLS ("SSL") secure connection should be used. An insecure connection cannot be used with Basic authentication as it would lead to a possible compromise of the private API key while in transit. [Find out more about TLS](https://faqs.ably.com/are-messages-sent-to-and-received-from-ably-securely-using-tls). The default is true. | `Boolean` | -| clientId | A client ID, used for identifying this client when publishing messages or for presence purposes. The `clientId` can be any non-empty string. This option is primarily intended to be used in situations where the library is instantiated with a key; note that a `clientId` may also be implicit in a token used to instantiate the library; an error will be raised if a `clientId` specified here conflicts with the `clientId` implicit in the token. [Find out more about client identities](/docs/auth/identified-clients) | `String` | -| useTokenAuth | When true, forces [Token authentication](/docs/auth/token) to be used by the library. Please note that if a `clientId` is not specified in the [`ClientOptions`](/docs/api/realtime-sdk/types#client-options) or [`TokenParams`](/docs/api/realtime-sdk/types#token-params), then the Ably Token issued will be [anonymous](https://faqs.ably.com/authenticated-and-identified-clients). The default is false. | `Boolean` | +| clientId | A client ID, used for identifying this client when publishing messages or for presence purposes. The `clientId` can be any non-empty string. This option is primarily intended to be used in situations where the library is instantiated with a key; note that a `clientId` may also be implicit in a token used to instantiate the library; an error will be raised if a `clientId` specified here conflicts with the `clientId` implicit in the token. [Find out more about client identities](/docs/platform/auth/identified-clients) | `String` | +| useTokenAuth | When true, forces [Token authentication](/docs/platform/auth/token) to be used by the library. Please note that if a `clientId` is not specified in the [`ClientOptions`](/docs/api/realtime-sdk/types#client-options) or [`TokenParams`](/docs/api/realtime-sdk/types#token-params), then the Ably Token issued will be [anonymous](https://faqs.ably.com/authenticated-and-identified-clients). The default is false. | `Boolean` | | endpoint | Enables [enterprise customers](https://ably.com/pricing) to use their own custom endpoints, which support dedicated, isolated clusters and regional message routing and storage constraints. See our [platform customization guide](/docs/platform/account/enterprise-customization) for more details. The default is Null. | `String` | | environment | Deprecated, use `endpoint`. Enables [enterprise customers](https://ably.com/pricing) to use their own custom environments, which support dedicated, isolated clusters and regional message routing and storage constraints. See our [platform customization guide](/docs/platform/account/enterprise-customization) for more details. The default is Null. | `String` | | idempotentRestPublishing | When true, enables idempotent publishing by assigning a unique message ID client-side, allowing the Ably servers to discard automatic publish retries following a failure such as a network fault. We recommend you enable this by default. In version 1.2 onwards, idempotent publishing for retries will be enabled by default. The default is false. | `Boolean` | @@ -1893,7 +1893,7 @@ A `TokenRevocationFailureResult` contains information about the result of an uns | logLevel | A number controlling the verbosity of the output from 2 (maximum, verbose) to 6 (errors only). A special value of 99 will silence all logging. Note that the `logLevel` is a static variable in the library and will thus not act independently between library instances when multiple library instances exist concurrently. See [the logging section of the java library README](https://github.com/ably/ably-java/#logging) for more details. The default is 5. | `Integer` | | logHandler | A `LogHandler` interface can be specified to handle each line of log output. If `logHandler` is not specified, `System.out` is used. Note that the `logHandler` is a static variable in the library and will thus not act independently between library instances when multiple library instances exist concurrently. See [the logging section of the java library README](https://github.com/ably/ably-java/#logging) for more details. The default is `System.out PrintStream`. | `PrintStream` | | useBinaryProtocol | If set to false, will forcibly disable the binary protocol (MessagePack). The binary protocol is used by default unless it is not supported. The default is true. Find out more about the [benefits of binary encoding](https://faqs.ably.com/do-you-binary-encode-your-messages-for-greater-efficiency) | `Boolean` | -| queryTime | If true, the library will query the Ably servers for the current time when [issuing TokenRequests](/docs/auth/token) instead of relying on a locally-available time of day. Knowing the time accurately is needed to create valid signed Ably [TokenRequests](/docs/api/rest-sdk/authentication#token-request), so this option is useful for library instances on auth servers where for some reason the server clock cannot be kept synchronized through normal means, such as an [NTP daemon](https://en.wikipedia.org/wiki/Ntpd). The server is queried for the current time once per client library instance (which stores the offset from the local clock), so if using this option you should avoid instancing a new version of the library for each request. The default is false. | `Boolean` | +| queryTime | If true, the library will query the Ably servers for the current time when [issuing TokenRequests](/docs/platform/auth/token) instead of relying on a locally-available time of day. Knowing the time accurately is needed to create valid signed Ably [TokenRequests](/docs/api/rest-sdk/authentication#token-request), so this option is useful for library instances on auth servers where for some reason the server clock cannot be kept synchronized through normal means, such as an [NTP daemon](https://en.wikipedia.org/wiki/Ntpd). The server is queried for the current time once per client library instance (which stores the offset from the local clock), so if using this option you should avoid instancing a new version of the library for each request. The default is false. | `Boolean` | | defaultTokenParams | When a [TokenParams](/docs/api/rest-sdk/types#token-params) object is provided, it will override the client library defaults when issuing new [Ably Tokens](/docs/api/realtime-sdk/authentication#token-details) or [Ably TokenRequests](/docs/api/rest-sdk/authentication#token-request) | [`TokenParams`](/docs/api/rest-sdk/types#token-params) | @@ -1901,17 +1901,17 @@ A `TokenRevocationFailureResult` contains information about the result of an uns | Parameter | Description | Type | |-----------|-------------|------| -| Key | The full key string, as obtained from the [application dashboard](https://ably.com/dashboard). Use this option if you wish to use Basic authentication, or wish to be able to issue Ably Tokens without needing to defer to a separate entity to sign Ably TokenRequests. Read more about [Basic authentication](/docs/auth/basic) | `String` | -| Token | An authenticated token. This can either be a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) object, a [`TokenRequest`](/docs/api/realtime-sdk/types#token-request) object, or token string (obtained from the `Token` property of a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) component of an Ably TokenRequest response, or a [JSON Web Token](https://tools.ietf.org/html/rfc7519) satisfying [the Ably requirements for JWTs](/docs/auth/token#jwt)). This option is mostly useful for testing: since tokens are short-lived, in production you almost always want to use an authentication method that allows the client library to renew the token automatically when the previous one expires, such as `AuthUrl` or `AuthCallback`. Read more about [Token authentication](/docs/auth/token) | `String`, `TokenDetails` or `TokenRequest` | -| AuthCallback | A function which is called when a new token is required. The role of the callback is to obtain a fresh token, one of: an Ably Token string (in plain text format); a signed [`TokenRequest`](/docs/api/realtime-sdk/types#token-request); a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) (in JSON format); an [Ably JWT](/docs/api/realtime-sdk/authentication#ably-jwt). See [our authentication documentation](/docs/auth) for details of the Ably TokenRequest format and associated API calls. | `Func>` | +| Key | The full key string, as obtained from the [application dashboard](https://ably.com/dashboard). Use this option if you wish to use Basic authentication, or wish to be able to issue Ably Tokens without needing to defer to a separate entity to sign Ably TokenRequests. Read more about [Basic authentication](/docs/platform/auth/basic) | `String` | +| Token | An authenticated token. This can either be a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) object, a [`TokenRequest`](/docs/api/realtime-sdk/types#token-request) object, or token string (obtained from the `Token` property of a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) component of an Ably TokenRequest response, or a [JSON Web Token](https://tools.ietf.org/html/rfc7519) satisfying [the Ably requirements for JWTs](/docs/platform/auth/token#jwt)). This option is mostly useful for testing: since tokens are short-lived, in production you almost always want to use an authentication method that allows the client library to renew the token automatically when the previous one expires, such as `AuthUrl` or `AuthCallback`. Read more about [Token authentication](/docs/platform/auth/token) | `String`, `TokenDetails` or `TokenRequest` | +| AuthCallback | A function which is called when a new token is required. The role of the callback is to obtain a fresh token, one of: an Ably Token string (in plain text format); a signed [`TokenRequest`](/docs/api/realtime-sdk/types#token-request); a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) (in JSON format); an [Ably JWT](/docs/api/realtime-sdk/authentication#ably-jwt). See [our authentication documentation](/docs/platform/auth) for details of the Ably TokenRequest format and associated API calls. | `Func>` | | AuthUrl | A URL that the library may use to obtain a fresh token, one of: an Ably Token string (in plain text format); a signed [`TokenRequest`](/docs/api/realtime-sdk/types#token-request); a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) (in JSON format); an [Ably JWT](/docs/api/realtime-sdk/authentication#ably-jwt). For example, this can be used by a client to obtain signed Ably TokenRequests from an application server. | `Uri` | | AuthMethod | The HTTP verb to use for the request, either `GET` or `POST`. The default is `GET`. | `HttpMethod` | | AuthHeaders | A set of key value pair headers to be added to any request made to the `AuthUrl`. Useful when an application requires these to be added to validate the request or implement the response. | `Dictionary` | | AuthParams | A set of key value pair params to be added to any request made to the `AuthUrl`. When the `AuthMethod` is `GET`, query params are added to the URL, whereas when `AuthMethod` is `POST`, the params are sent as URL encoded form data. Useful when an application require these to be added to validate the request or implement the response. | `Dictionary` | -| TokenDetails | An authenticated [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) object (most commonly obtained from an Ably Token Request response). This option is mostly useful for testing: since tokens are short-lived, in production you almost always want to use an authentication method that allows the client library to renew the token automatically when the previous one expires, such as `AuthUrl` or `AuthCallback`. Use this option if you wish to use Token authentication. Read more about [Token authentication](/docs/auth/token) | `TokenDetails` | +| TokenDetails | An authenticated [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) object (most commonly obtained from an Ably Token Request response). This option is mostly useful for testing: since tokens are short-lived, in production you almost always want to use an authentication method that allows the client library to renew the token automatically when the previous one expires, such as `AuthUrl` or `AuthCallback`. Use this option if you wish to use Token authentication. Read more about [Token authentication](/docs/platform/auth/token) | `TokenDetails` | | Tls | A boolean value, indicating whether or not a TLS ("SSL") secure connection should be used. An insecure connection cannot be used with Basic authentication as it would lead to a possible compromise of the private API key while in transit. [Find out more about TLS](https://faqs.ably.com/are-messages-sent-to-and-received-from-ably-securely-using-tls). The default is true. | `Boolean` | -| ClientId | A client ID, used for identifying this client when publishing messages or for presence purposes. The `ClientId` can be any non-empty string. This option is primarily intended to be used in situations where the library is instantiated with a key; note that a `ClientId` may also be implicit in a token used to instantiate the library; an error will be raised if a `ClientId` specified here conflicts with the `ClientId` implicit in the token. [Find out more about client identities](/docs/auth/identified-clients) | `String` | -| UseTokenAuth | When true, forces [Token authentication](/docs/auth/token) to be used by the library. Please note that if a `clientId` is not specified in the [`ClientOptions`](/docs/api/realtime-sdk/types#client-options) or [`TokenParams`](/docs/api/realtime-sdk/types#token-params), then the Ably Token issued will be [anonymous](https://faqs.ably.com/authenticated-and-identified-clients). The default is false. | `Boolean` | +| ClientId | A client ID, used for identifying this client when publishing messages or for presence purposes. The `ClientId` can be any non-empty string. This option is primarily intended to be used in situations where the library is instantiated with a key; note that a `ClientId` may also be implicit in a token used to instantiate the library; an error will be raised if a `ClientId` specified here conflicts with the `ClientId` implicit in the token. [Find out more about client identities](/docs/platform/auth/identified-clients) | `String` | +| UseTokenAuth | When true, forces [Token authentication](/docs/platform/auth/token) to be used by the library. Please note that if a `clientId` is not specified in the [`ClientOptions`](/docs/api/realtime-sdk/types#client-options) or [`TokenParams`](/docs/api/realtime-sdk/types#token-params), then the Ably Token issued will be [anonymous](https://faqs.ably.com/authenticated-and-identified-clients). The default is false. | `Boolean` | | Endpoint | Enables [enterprise customers](https://ably.com/pricing) to use their own custom endpoints, which support dedicated, isolated clusters and regional message routing and storage constraints. See our [platform customization guide](/docs/platform/account/enterprise-customization) for more details. The default is null. | `String` | | Environment | Deprecated, use `endpoint`. Enables [enterprise customers](https://ably.com/pricing) to use their own custom environments, which support dedicated, isolated clusters and regional message routing and storage constraints. See our [platform customization guide](/docs/platform/account/enterprise-customization) for more details. The default is null. | `String` | | IdempotentRestPublishing | When true, enables idempotent publishing by assigning a unique message ID client-side, allowing the Ably servers to discard automatic publish retries following a failure such as a network fault. We recommend you enable this by default. In version 1.2 onwards, idempotent publishing for retries will be enabled by default. The default is false. | `Boolean` | @@ -1920,7 +1920,7 @@ A `TokenRevocationFailureResult` contains information about the result of an uns | LogLevel | This is an enum controlling the verbosity of the output from `Debug` (maximum) to `Error` (errors only). A special value of `None` will silence all logging. Note that the `LogLevel` is a static variable in the library and will thus not act independently between library instances. The default is `Error`. | `Enum` | | LoggerSink | The default ILoggerSink outputs messages to the debug console. This property allows the user to pipe the log messages to their own logging infrastructure. The default is `IO.Ably.DefaultLoggerSink`. | | | UseBinaryProtocol | If set to false, will forcibly disable the binary protocol (MessagePack). The binary protocol is used by default unless it is not supported. The default is true. Find out more about the [benefits of binary encoding](https://faqs.ably.com/do-you-binary-encode-your-messages-for-greater-efficiency) | `Boolean` | -| QueryTime | If true, the library will query the Ably servers for the current time when [issuing TokenRequests](/docs/auth/token) instead of relying on a locally-available time of day. Knowing the time accurately is needed to create valid signed Ably [TokenRequests](/docs/api/rest-sdk/authentication#token-request), so this option is useful for library instances on auth servers where for some reason the server clock cannot be kept synchronized through normal means, such as an [NTP daemon](https://en.wikipedia.org/wiki/Ntpd). The server is queried for the current time once per client library instance (which stores the offset from the local clock), so if using this option you should avoid instancing a new version of the library for each request. The default is false. | `Boolean` | +| QueryTime | If true, the library will query the Ably servers for the current time when [issuing TokenRequests](/docs/platform/auth/token) instead of relying on a locally-available time of day. Knowing the time accurately is needed to create valid signed Ably [TokenRequests](/docs/api/rest-sdk/authentication#token-request), so this option is useful for library instances on auth servers where for some reason the server clock cannot be kept synchronized through normal means, such as an [NTP daemon](https://en.wikipedia.org/wiki/Ntpd). The server is queried for the current time once per client library instance (which stores the offset from the local clock), so if using this option you should avoid instancing a new version of the library for each request. The default is false. | `Boolean` | | DefaultTokenParams | When a [TokenParams](/docs/api/rest-sdk/types#token-params) object is provided, it will override the client library defaults when issuing new [Ably Tokens](/docs/api/realtime-sdk/authentication#token-details) or [Ably TokenRequests](/docs/api/rest-sdk/authentication#token-request) | [`TokenParams`](/docs/api/rest-sdk/types#token-params) | @@ -1928,17 +1928,17 @@ A `TokenRevocationFailureResult` contains information about the result of an uns | Parameter | Description | Type | |-----------|-------------|------| -| Key | The full key string, as obtained from the [application dashboard](https://ably.com/dashboard). Use this option if you wish to use Basic authentication, or wish to be able to issue Ably Tokens without needing to defer to a separate entity to sign Ably TokenRequests. Read more about [Basic authentication](/docs/auth/basic) | `String` | -| Token | An authenticated token. This can either be a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) object, a [`TokenRequest`](/docs/api/realtime-sdk/types#token-request) object, or token string (obtained from the `Token` property of a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) component of an Ably TokenRequest response, or a [JSON Web Token](https://tools.ietf.org/html/rfc7519) satisfying [the Ably requirements for JWTs](/docs/auth/token#jwt)). This option is mostly useful for testing: since tokens are short-lived, in production you almost always want to use an authentication method that allows the client library to renew the token automatically when the previous one expires, such as `AuthUrl` or `AuthCallback`. Read more about [Token authentication](/docs/auth/token) | `String`, `TokenDetails` or `TokenRequest` | -| AuthCallback | A function which is called when a new token is required. The role of the callback is to obtain a fresh token, one of: an Ably Token string (in plain text format); a signed [`TokenRequest`](/docs/api/realtime-sdk/types#token-request); a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) (in JSON format); an [Ably JWT](/docs/api/realtime-sdk/authentication#ably-jwt). See [our authentication documentation](/docs/auth) for details of the Ably TokenRequest format and associated API calls. | `Callable` | +| Key | The full key string, as obtained from the [application dashboard](https://ably.com/dashboard). Use this option if you wish to use Basic authentication, or wish to be able to issue Ably Tokens without needing to defer to a separate entity to sign Ably TokenRequests. Read more about [Basic authentication](/docs/platform/auth/basic) | `String` | +| Token | An authenticated token. This can either be a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) object, a [`TokenRequest`](/docs/api/realtime-sdk/types#token-request) object, or token string (obtained from the `Token` property of a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) component of an Ably TokenRequest response, or a [JSON Web Token](https://tools.ietf.org/html/rfc7519) satisfying [the Ably requirements for JWTs](/docs/platform/auth/token#jwt)). This option is mostly useful for testing: since tokens are short-lived, in production you almost always want to use an authentication method that allows the client library to renew the token automatically when the previous one expires, such as `AuthUrl` or `AuthCallback`. Read more about [Token authentication](/docs/platform/auth/token) | `String`, `TokenDetails` or `TokenRequest` | +| AuthCallback | A function which is called when a new token is required. The role of the callback is to obtain a fresh token, one of: an Ably Token string (in plain text format); a signed [`TokenRequest`](/docs/api/realtime-sdk/types#token-request); a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) (in JSON format); an [Ably JWT](/docs/api/realtime-sdk/authentication#ably-jwt). See [our authentication documentation](/docs/platform/auth) for details of the Ably TokenRequest format and associated API calls. | `Callable` | | AuthUrl | A URL that the library may use to obtain a fresh token, one of: an Ably Token string (in plain text format); a signed [`TokenRequest`](/docs/api/realtime-sdk/types#token-request); a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) (in JSON format); an [Ably JWT](/docs/api/realtime-sdk/authentication#ably-jwt). For example, this can be used by a client to obtain signed Ably TokenRequests from an application server. | `String` | | AuthMethod | The HTTP verb to use for the request, either `GET` or `POST`. The default is `GET`. | `String` | | AuthHeaders | A set of key value pair headers to be added to any request made to the `authUrl`. Useful when an application requires these to be added to validate the request or implement the response. | `Object` | | AuthParams | A set of key value pair params to be added to any request made to the `AuthUrl`. When the `AuthMethod` is `GET`, query params are added to the URL, whereas when `AuthMethod` is `POST`, the params are sent as URL encoded form data. Useful when an application require these to be added to validate the request or implement the response. | `Object` | -| TokenDetails | An authenticated [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) object (most commonly obtained from an Ably Token Request response). This option is mostly useful for testing: since tokens are short-lived, in production you almost always want to use an authentication method that allows the client library to renew the token automatically when the previous one expires, such as `AuthUrl` or `AuthCallback`. Use this option if you wish to use Token authentication. Read more about [Token authentication](/docs/auth/token) | `TokenDetails` | +| TokenDetails | An authenticated [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) object (most commonly obtained from an Ably Token Request response). This option is mostly useful for testing: since tokens are short-lived, in production you almost always want to use an authentication method that allows the client library to renew the token automatically when the previous one expires, such as `AuthUrl` or `AuthCallback`. Use this option if you wish to use Token authentication. Read more about [Token authentication](/docs/platform/auth/token) | `TokenDetails` | | Tls | A boolean value, indicating whether or not a TLS ("SSL") secure connection should be used. An insecure connection cannot be used with Basic authentication as it would lead to a possible compromise of the private API key while in transit. [Find out more about TLS](https://faqs.ably.com/are-messages-sent-to-and-received-from-ably-securely-using-tls). The default is true. | `Boolean` | -| ClientId | A client ID, used for identifying this client when publishing messages or for presence purposes. The `ClientId` can be any non-empty string. This option is primarily intended to be used in situations where the library is instantiated with a key; note that a `ClientId` may also be implicit in a token used to instantiate the library; an error will be raised if a `ClientId` specified here conflicts with the `ClientId` implicit in the token. [Find out more about client identities](/docs/auth/identified-clients) | `String` | -| UseTokenAuth | When true, forces [Token authentication](/docs/auth/token) to be used by the library. Please note that if a `clientId` is not specified in the [`ClientOptions`](/docs/api/realtime-sdk/types#client-options) or [`TokenParams`](/docs/api/realtime-sdk/types#token-params), then the Ably Token issued will be [anonymous](https://faqs.ably.com/authenticated-and-identified-clients). The default is false. | `Boolean` | +| ClientId | A client ID, used for identifying this client when publishing messages or for presence purposes. The `ClientId` can be any non-empty string. This option is primarily intended to be used in situations where the library is instantiated with a key; note that a `ClientId` may also be implicit in a token used to instantiate the library; an error will be raised if a `ClientId` specified here conflicts with the `ClientId` implicit in the token. [Find out more about client identities](/docs/platform/auth/identified-clients) | `String` | +| UseTokenAuth | When true, forces [Token authentication](/docs/platform/auth/token) to be used by the library. Please note that if a `clientId` is not specified in the [`ClientOptions`](/docs/api/realtime-sdk/types#client-options) or [`TokenParams`](/docs/api/realtime-sdk/types#token-params), then the Ably Token issued will be [anonymous](https://faqs.ably.com/authenticated-and-identified-clients). The default is false. | `Boolean` | | Endpoint | Enables [enterprise customers](https://ably.com/pricing) to use their own custom endpoints, which support dedicated, isolated clusters and regional message routing and storage constraints. See our [platform customization guide](/docs/platform/account/enterprise-customization) for more details. The default is null. | `String` | | Environment | Deprecated, use `endpoint`. Enables [enterprise customers](https://ably.com/pricing) to use their own custom environments, which support dedicated, isolated clusters and regional message routing and storage constraints. See our [platform customization guide](/docs/platform/account/enterprise-customization) for more details. The default is null. | `String` | | IdempotentRestPublishing | When true, enables idempotent publishing by assigning a unique message ID client-side, allowing the Ably servers to discard automatic publish retries following a failure such as a network fault. We recommend you enable this by default. In version 1.2 onwards, idempotent publishing for retries will be enabled by default. The default is false. | `Boolean` | @@ -1946,7 +1946,7 @@ A `TokenRevocationFailureResult` contains information about the result of an uns | transportParams | Optional. Can be used to pass in arbitrary connection parameters, such as [`heartbeatInterval`](/docs/connect#heartbeats) and [`remainPresentFor`](/docs/presence-occupancy/presence#unstable-connections) | `Object` | | LogLevel | This is an enum controlling the verbosity of the output from `LogDebug` (maximum) to `LogError` (errors only). A special value of `LogNone` will silence all logging. Note that the `LogLevel` is a static variable in the library and will thus not act independently between library instances. The default is `LogError`. | `Enum` | | UseBinaryProtocol | If set to false, will forcibly disable the binary protocol (MessagePack). The binary protocol is used by default unless it is not supported. The default is true. Find out more about the [benefits of binary encoding](https://faqs.ably.com/do-you-binary-encode-your-messages-for-greater-efficiency) | `Boolean` | -| QueryTime | If true, the library will query the Ably servers for the current time when [issuing TokenRequests](/docs/auth/token) instead of relying on a locally-available time of day. Knowing the time accurately is needed to create valid signed Ably [TokenRequests](/docs/api/rest-sdk/authentication#token-request), so this option is useful for library instances on auth servers where for some reason the server clock cannot be kept synchronized through normal means, such as an [NTP daemon](https://en.wikipedia.org/wiki/Ntpd). The server is queried for the current time once per client library instance (which stores the offset from the local clock), so if using this option you should avoid instancing a new version of the library for each request. The default is false. | `Boolean` | +| QueryTime | If true, the library will query the Ably servers for the current time when [issuing TokenRequests](/docs/platform/auth/token) instead of relying on a locally-available time of day. Knowing the time accurately is needed to create valid signed Ably [TokenRequests](/docs/api/rest-sdk/authentication#token-request), so this option is useful for library instances on auth servers where for some reason the server clock cannot be kept synchronized through normal means, such as an [NTP daemon](https://en.wikipedia.org/wiki/Ntpd). The server is queried for the current time once per client library instance (which stores the offset from the local clock), so if using this option you should avoid instancing a new version of the library for each request. The default is false. | `Boolean` | | DefaultTokenParams | When a [TokenParams](/docs/api/rest-sdk/types#token-params) object is provided, it will override the client library defaults when issuing new [Ably Tokens](/docs/api/realtime-sdk/authentication#token-details) or [Ably TokenRequests](/docs/api/rest-sdk/authentication#token-request) | [`TokenParams`](/docs/api/rest-sdk/types#token-params) | @@ -1954,17 +1954,17 @@ A `TokenRevocationFailureResult` contains information about the result of an uns | Parameter | Description | Type | |-----------|-------------|------| -| key | The full key string, as obtained from the [application dashboard](https://ably.com/dashboard). Use this option if you wish to use Basic authentication, or wish to be able to issue Ably Tokens without needing to defer to a separate entity to sign Ably TokenRequests. Read more about [Basic authentication](/docs/auth/basic) | `String` | -| token | An authenticated token. This can either be a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) object, a [`TokenRequest`](/docs/api/realtime-sdk/types#token-request) object, or token string (obtained from the `token` property of a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) component of an Ably TokenRequest response, or a [JSON Web Token](https://tools.ietf.org/html/rfc7519) satisfying [the Ably requirements for JWTs](/docs/auth/token#jwt)). This option is mostly useful for testing: since tokens are short-lived, in production you almost always want to use an authentication method that allows the client library to renew the token automatically when the previous one expires, such as `authUrl` or `authCallback`. Read more about [Token authentication](/docs/auth/token) | `String`, `TokenDetails` or `TokenRequest` | -| authCallback | A function which is called when a new token is required. The role of the callback is to obtain a fresh token, one of: an Ably Token string (in plain text format); a signed [`TokenRequest`](/docs/api/realtime-sdk/types#token-request); a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) (in JSON format); an [Ably JWT](/docs/api/realtime-sdk/authentication#ably-jwt). See [our authentication documentation](/docs/auth) for details of the Ably TokenRequest format and associated API calls. | `Callable` | +| key | The full key string, as obtained from the [application dashboard](https://ably.com/dashboard). Use this option if you wish to use Basic authentication, or wish to be able to issue Ably Tokens without needing to defer to a separate entity to sign Ably TokenRequests. Read more about [Basic authentication](/docs/platform/auth/basic) | `String` | +| token | An authenticated token. This can either be a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) object, a [`TokenRequest`](/docs/api/realtime-sdk/types#token-request) object, or token string (obtained from the `token` property of a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) component of an Ably TokenRequest response, or a [JSON Web Token](https://tools.ietf.org/html/rfc7519) satisfying [the Ably requirements for JWTs](/docs/platform/auth/token#jwt)). This option is mostly useful for testing: since tokens are short-lived, in production you almost always want to use an authentication method that allows the client library to renew the token automatically when the previous one expires, such as `authUrl` or `authCallback`. Read more about [Token authentication](/docs/platform/auth/token) | `String`, `TokenDetails` or `TokenRequest` | +| authCallback | A function which is called when a new token is required. The role of the callback is to obtain a fresh token, one of: an Ably Token string (in plain text format); a signed [`TokenRequest`](/docs/api/realtime-sdk/types#token-request); a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) (in JSON format); an [Ably JWT](/docs/api/realtime-sdk/authentication#ably-jwt). See [our authentication documentation](/docs/platform/auth) for details of the Ably TokenRequest format and associated API calls. | `Callable` | | authUrl | A URL that the library may use to obtain a fresh token, one of: an Ably Token string (in plain text format); a signed [`TokenRequest`](/docs/api/realtime-sdk/types#token-request); a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) (in JSON format); an [Ably JWT](/docs/api/realtime-sdk/authentication#ably-jwt). For example, this can be used by a client to obtain signed Ably TokenRequests from an application server. | `NSURL` | | authMethod | The HTTP verb to use for the request, either `GET` or `POST`. The default is `GET`. | `String` | | authHeaders | A set of key value pair headers to be added to any request made to the `authUrl`. Useful when an application requires these to be added to validate the request or implement the response. | `Object` | | authParams | A set of key value pair params to be added to any request made to the `authUrl`. When the `authMethod` is `GET`, query params are added to the URL, whereas when `authMethod` is `POST`, the params are sent as URL encoded form data. Useful when an application require these to be added to validate the request or implement the response. | `NSArray``[NSURLQueryItem]/Array` | -| tokenDetails | An authenticated [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) object (most commonly obtained from an Ably Token Request response). This option is mostly useful for testing: since tokens are short-lived, in production you almost always want to use an authentication method that allows the client library to renew the token automatically when the previous one expires, such as `authUrl` or `authCallback`. Use this option if you wish to use Token authentication. Read more about [Token authentication](/docs/auth/token) | `TokenDetails` | +| tokenDetails | An authenticated [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) object (most commonly obtained from an Ably Token Request response). This option is mostly useful for testing: since tokens are short-lived, in production you almost always want to use an authentication method that allows the client library to renew the token automatically when the previous one expires, such as `authUrl` or `authCallback`. Use this option if you wish to use Token authentication. Read more about [Token authentication](/docs/platform/auth/token) | `TokenDetails` | | tls | A boolean value, indicating whether or not a TLS ("SSL") secure connection should be used. An insecure connection cannot be used with Basic authentication as it would lead to a possible compromise of the private API key while in transit. [Find out more about TLS](https://faqs.ably.com/are-messages-sent-to-and-received-from-ably-securely-using-tls). The default is true. | `Boolean` | -| clientId | A client ID, used for identifying this client when publishing messages or for presence purposes. The `clientId` can be any non-empty string. This option is primarily intended to be used in situations where the library is instantiated with a key; note that a `clientId` may also be implicit in a token used to instantiate the library; an error will be raised if a `clientId` specified here conflicts with the `clientId` implicit in the token. [Find out more about client identities](/docs/auth/identified-clients) | `String` | -| useTokenAuth | When true, forces [Token authentication](/docs/auth/token) to be used by the library. Please note that if a `clientId` is not specified in the [`ClientOptions`](/docs/api/realtime-sdk/types#client-options) or [`TokenParams`](/docs/api/realtime-sdk/types#token-params), then the Ably Token issued will be [anonymous](https://faqs.ably.com/authenticated-and-identified-clients). The default is false. | `Boolean` | +| clientId | A client ID, used for identifying this client when publishing messages or for presence purposes. The `clientId` can be any non-empty string. This option is primarily intended to be used in situations where the library is instantiated with a key; note that a `clientId` may also be implicit in a token used to instantiate the library; an error will be raised if a `clientId` specified here conflicts with the `clientId` implicit in the token. [Find out more about client identities](/docs/platform/auth/identified-clients) | `String` | +| useTokenAuth | When true, forces [Token authentication](/docs/platform/auth/token) to be used by the library. Please note that if a `clientId` is not specified in the [`ClientOptions`](/docs/api/realtime-sdk/types#client-options) or [`TokenParams`](/docs/api/realtime-sdk/types#token-params), then the Ably Token issued will be [anonymous](https://faqs.ably.com/authenticated-and-identified-clients). The default is false. | `Boolean` | | endpoint | Enables [enterprise customers](https://ably.com/pricing) to use their own custom endpoints, which support dedicated, isolated clusters and regional message routing and storage constraints. See our [platform customization guide](/docs/platform/account/enterprise-customization) for more details. The default is nil. | `String` | | environment | Deprecated, use `endpoint`. Enables [enterprise customers](https://ably.com/pricing) to use their own custom environments, which support dedicated, isolated clusters and regional message routing and storage constraints. See our [platform customization guide](/docs/platform/account/enterprise-customization) for more details. The default is nil. | `String` | | idempotentRestPublishing | When true, enables idempotent publishing by assigning a unique message ID client-side, allowing the Ably servers to discard automatic publish retries following a failure such as a network fault. We recommend you enable this by default. In version 1.2 onwards, idempotent publishing for retries will be enabled by default. The default is false. | `Boolean` | @@ -1974,7 +1974,7 @@ A `TokenRevocationFailureResult` contains information about the result of an uns | logHandler | A `ARTLog` object can be specified to handle each line of log output. If `logHandler` is not specified, a default `ARTLog` instance is used. | `ARTLog *` | | useBinaryProtocol | Note: The binary protocol is currently not supported in Swiftin Objective-C. Find out more about the [benefits of binary encoding](https://faqs.ably.com/do-you-binary-encode-your-messages-for-greater-efficiency) | `Boolean` | | logExceptionReportingUrl | Defaults to a string value for an Ably error reporting Data Source Name. | `String` | -| queryTime | If true, the library will query the Ably servers for the current time when [issuing TokenRequests](/docs/auth/token) instead of relying on a locally-available time of day. Knowing the time accurately is needed to create valid signed Ably [TokenRequests](/docs/api/rest-sdk/authentication#token-request), so this option is useful for library instances on auth servers where for some reason the server clock cannot be kept synchronized through normal means, such as an [NTP daemon](https://en.wikipedia.org/wiki/Ntpd). The server is queried for the current time once per client library instance (which stores the offset from the local clock), so if using this option you should avoid instancing a new version of the library for each request. The default is false. | `Boolean` | +| queryTime | If true, the library will query the Ably servers for the current time when [issuing TokenRequests](/docs/platform/auth/token) instead of relying on a locally-available time of day. Knowing the time accurately is needed to create valid signed Ably [TokenRequests](/docs/api/rest-sdk/authentication#token-request), so this option is useful for library instances on auth servers where for some reason the server clock cannot be kept synchronized through normal means, such as an [NTP daemon](https://en.wikipedia.org/wiki/Ntpd). The server is queried for the current time once per client library instance (which stores the offset from the local clock), so if using this option you should avoid instancing a new version of the library for each request. The default is false. | `Boolean` | | defaultTokenParams | When a [TokenParams](/docs/api/rest-sdk/types#token-params) object is provided, it will override the client library defaults when issuing new [Ably Tokens](/docs/api/realtime-sdk/authentication#token-details) or [Ably TokenRequests](/docs/api/rest-sdk/authentication#token-request) | [`TokenParams`](/docs/api/rest-sdk/types#token-params) | @@ -1982,17 +1982,17 @@ A `TokenRevocationFailureResult` contains information about the result of an uns | Parameter | Description | Type | |-----------|-------------|------| -| :key | The full key string, as obtained from the [application dashboard](https://ably.com/dashboard). Use this option if you wish to use Basic authentication, or wish to be able to issue Ably Tokens without needing to defer to a separate entity to sign Ably TokenRequests. Read more about [Basic authentication](/docs/auth/basic) | `String` | -| :token | An authenticated token. This can either be a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) object, a [`TokenRequest`](/docs/api/realtime-sdk/types#token-request) object, or token string (obtained from the `token` property of a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) component of an Ably TokenRequest response, or a [JSON Web Token](https://tools.ietf.org/html/rfc7519) satisfying [the Ably requirements for JWTs](/docs/auth/token#jwt)). This option is mostly useful for testing: since tokens are short-lived, in production you almost always want to use an authentication method that allows the client library to renew the token automatically when the previous one expires, such as `:auth_url` or `:auth_callback`. Read more about [Token authentication](/docs/auth/token) | `String`, `TokenDetails` or `TokenRequest` | -| :auth_callback | A proc / lambda (called synchronously in REST and Realtime but does not block EventMachine in the latter) which is called when a new token is required. The role of the callback is to obtain a fresh token, one of: an Ably Token string (in plain text format); a signed [`TokenRequest`](/docs/api/realtime-sdk/types#token-request); a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) (in JSON format); an [Ably JWT](/docs/api/realtime-sdk/authentication#ably-jwt). See [our authentication documentation](/docs/auth) for details of the Ably TokenRequest format and associated API calls. | `Proc` | +| :key | The full key string, as obtained from the [application dashboard](https://ably.com/dashboard). Use this option if you wish to use Basic authentication, or wish to be able to issue Ably Tokens without needing to defer to a separate entity to sign Ably TokenRequests. Read more about [Basic authentication](/docs/platform/auth/basic) | `String` | +| :token | An authenticated token. This can either be a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) object, a [`TokenRequest`](/docs/api/realtime-sdk/types#token-request) object, or token string (obtained from the `token` property of a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) component of an Ably TokenRequest response, or a [JSON Web Token](https://tools.ietf.org/html/rfc7519) satisfying [the Ably requirements for JWTs](/docs/platform/auth/token#jwt)). This option is mostly useful for testing: since tokens are short-lived, in production you almost always want to use an authentication method that allows the client library to renew the token automatically when the previous one expires, such as `:auth_url` or `:auth_callback`. Read more about [Token authentication](/docs/platform/auth/token) | `String`, `TokenDetails` or `TokenRequest` | +| :auth_callback | A proc / lambda (called synchronously in REST and Realtime but does not block EventMachine in the latter) which is called when a new token is required. The role of the callback is to obtain a fresh token, one of: an Ably Token string (in plain text format); a signed [`TokenRequest`](/docs/api/realtime-sdk/types#token-request); a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) (in JSON format); an [Ably JWT](/docs/api/realtime-sdk/authentication#ably-jwt). See [our authentication documentation](/docs/platform/auth) for details of the Ably TokenRequest format and associated API calls. | `Proc` | | :auth_url | A URL that the library may use to obtain a fresh token, one of: an Ably Token string (in plain text format); a signed [`TokenRequest`](/docs/api/realtime-sdk/types#token-request); a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) (in JSON format); an [Ably JWT](/docs/api/realtime-sdk/authentication#ably-jwt). For example, this can be used by a client to obtain signed Ably TokenRequests from an application server. | `String` | | :auth_method | The HTTP verb to use for the request, either `:get` or `:post`. The default is `:get`. | `Symbol` | | :auth_headers | A set of key value pair headers to be added to any request made to the `authUrl`. Useful when an application requires these to be added to validate the request or implement the response. | `Hash` | | :auth_params | A set of key value pair params to be added to any request made to the `authUrl`. When the `authMethod` is `GET`, query params are added to the URL, whereas when `authMethod` is `POST`, the params are sent as URL encoded form data. Useful when an application require these to be added to validate the request or implement the response. | `Hash` | -| :token_details | An authenticated [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) object (most commonly obtained from an Ably Token Request response). This option is mostly useful for testing: since tokens are short-lived, in production you almost always want to use an authentication method that allows the client library to renew the token automatically when the previous one expires, such as `:auth_url` or `:auth_callback`. Use this option if you wish to use Token authentication. Read more about [Token authentication](/docs/auth/token) | `TokenDetails` | +| :token_details | An authenticated [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) object (most commonly obtained from an Ably Token Request response). This option is mostly useful for testing: since tokens are short-lived, in production you almost always want to use an authentication method that allows the client library to renew the token automatically when the previous one expires, such as `:auth_url` or `:auth_callback`. Use this option if you wish to use Token authentication. Read more about [Token authentication](/docs/platform/auth/token) | `TokenDetails` | | :tls | A boolean value, indicating whether or not a TLS ("SSL") secure connection should be used. An insecure connection cannot be used with Basic authentication as it would lead to a possible compromise of the private API key while in transit. [Find out more about TLS](https://faqs.ably.com/are-messages-sent-to-and-received-from-ably-securely-using-tls). The default is true. | `Boolean` | -| :client_id | A client ID, used for identifying this client when publishing messages or for presence purposes. The `client_id` can be any non-empty string. This option is primarily intended to be used in situations where the library is instantiated with a key; note that a `client_id` may also be implicit in a token used to instantiate the library; an error will be raised if a `client_id` specified here conflicts with the `client_id` implicit in the token. [Find out more about client identities](/docs/auth/identified-clients) | `String` | -| :use_token_auth | When true, forces [Token authentication](/docs/auth/token) to be used by the library. Please note that if a `client_id` is not specified in the [`ClientOptions`](/docs/api/realtime-sdk/types#client-options) or [`TokenParams`](/docs/api/realtime-sdk/types#token-params), then the Ably Token issued will be [anonymous](https://faqs.ably.com/authenticated-and-identified-clients). The default is false. | `Boolean` | +| :client_id | A client ID, used for identifying this client when publishing messages or for presence purposes. The `client_id` can be any non-empty string. This option is primarily intended to be used in situations where the library is instantiated with a key; note that a `client_id` may also be implicit in a token used to instantiate the library; an error will be raised if a `client_id` specified here conflicts with the `client_id` implicit in the token. [Find out more about client identities](/docs/platform/auth/identified-clients) | `String` | +| :use_token_auth | When true, forces [Token authentication](/docs/platform/auth/token) to be used by the library. Please note that if a `client_id` is not specified in the [`ClientOptions`](/docs/api/realtime-sdk/types#client-options) or [`TokenParams`](/docs/api/realtime-sdk/types#token-params), then the Ably Token issued will be [anonymous](https://faqs.ably.com/authenticated-and-identified-clients). The default is false. | `Boolean` | | :endpoint | Enables [enterprise customers](https://ably.com/pricing) to use their own custom endpoints, which support dedicated, isolated clusters and regional message routing and storage constraints. See our [platform customization guide](/docs/platform/account/enterprise-customization) for more details. The default is nil. | `String` | | :environment | Deprecated, use `endpoint`. Enables [enterprise customers](https://ably.com/pricing) to use their own custom environments, which support dedicated, isolated clusters and regional message routing and storage constraints. See our [platform customization guide](/docs/platform/account/enterprise-customization) for more details. The default is nil. | `String` | | :idempotent_rest_publishing | When true, enables idempotent publishing by assigning a unique message ID client-side, allowing the Ably servers to discard automatic publish retries following a failure such as a network fault. We recommend you enable this by default. In version 1.2 onwards, idempotent publishing for retries will be enabled by default. The default is false. | `Boolean` | @@ -2001,7 +2001,7 @@ A `TokenRevocationFailureResult` contains information about the result of an uns | :log_level | Log level for the standard Logger that outputs to `STDOUT`. Can be set to `:fatal`, `:error`, `:warn`, `:info`, `:debug` or `:none`. Alternatively a [`Logger` severity constant](http://ruby-doc.org/stdlib-2.2.0/libdoc/logger/rdoc/Logger.html#class-Logger-label-Description) can be specified. The default is `:error`. | `Symbol`, [`Logger::SEVERITY`](http://ruby-doc.org/stdlib-2.2.0/libdoc/logger/rdoc/Logger.html#class-Logger-label-Description) | | :logger | A [Ruby `Logger`](http://ruby-doc.org/stdlib-1.9.3/libdoc/logger/rdoc/Logger.html) compatible object to handle each line of log output. If `logger` is not specified, `STDOUT` is used. The default is `STDOUT Logger`. | [Ruby `Logger`](http://ruby-doc.org/stdlib-1.9.3/libdoc/logger/rdoc/Logger.html) | | :use_binary_protocol | If set to false, will forcibly disable the binary protocol (MessagePack). The binary protocol is used by default unless it is not supported. The default is true. Find out more about the [benefits of binary encoding](https://faqs.ably.com/do-you-binary-encode-your-messages-for-greater-efficiency) | `Boolean` | -| :query_time | If true, the library will query the Ably servers for the current time when [issuing TokenRequests](/docs/auth/token) instead of relying on a locally-available time of day. Knowing the time accurately is needed to create valid signed Ably [TokenRequests](/docs/api/rest-sdk/authentication#token-request), so this option is useful for library instances on auth servers where for some reason the server clock cannot be kept synchronized through normal means, such as an [NTP daemon](https://en.wikipedia.org/wiki/Ntpd). The server is queried for the current time once per client library instance (which stores the offset from the local clock), so if using this option you should avoid instancing a new version of the library for each request. The default is false. | `Boolean` | +| :query_time | If true, the library will query the Ably servers for the current time when [issuing TokenRequests](/docs/platform/auth/token) instead of relying on a locally-available time of day. Knowing the time accurately is needed to create valid signed Ably [TokenRequests](/docs/api/rest-sdk/authentication#token-request), so this option is useful for library instances on auth servers where for some reason the server clock cannot be kept synchronized through normal means, such as an [NTP daemon](https://en.wikipedia.org/wiki/Ntpd). The server is queried for the current time once per client library instance (which stores the offset from the local clock), so if using this option you should avoid instancing a new version of the library for each request. The default is false. | `Boolean` | | :default_token_params | When a [TokenParams](/docs/api/rest-sdk/types#token-params) object is provided, it will override the client library defaults when issuing new [Ably Tokens](/docs/api/realtime-sdk/authentication#token-details) or [Ably TokenRequests](/docs/api/rest-sdk/authentication#token-request) | [`TokenParams`](/docs/api/rest-sdk/types#token-params) | @@ -2009,17 +2009,17 @@ A `TokenRevocationFailureResult` contains information about the result of an uns | Parameter | Description | Type | |-----------|-------------|------| -| key | The full key string, as obtained from the [application dashboard](https://ably.com/dashboard). Use this option if you wish to use Basic authentication, or wish to be able to issue Ably Tokens without needing to defer to a separate entity to sign Ably TokenRequests. Read more about [Basic authentication](/docs/auth/basic) | `String` | -| token | An authenticated token. This can either be a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) object, a [`TokenRequest`](/docs/api/realtime-sdk/types#token-request) object, or token string (obtained from the `token` property of a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) component of an Ably TokenRequest response, or a [JSON Web Token](https://tools.ietf.org/html/rfc7519) satisfying [the Ably requirements for JWTs](/docs/auth/token#jwt)). This option is mostly useful for testing: since tokens are short-lived, in production you almost always want to use an authentication method that allows the client library to renew the token automatically when the previous one expires, such as `authUrl` or `authCallback`. Read more about [Token authentication](/docs/auth/token) | `String`, `TokenDetails` or `TokenRequest` | -| authCallback | A function which is called when a new token is required. The role of the callback is to obtain a fresh token, one of: an Ably Token string (in plain text format); a signed [`TokenRequest`](/docs/api/realtime-sdk/types#token-request); a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) (in JSON format); an [Ably JWT](/docs/api/realtime-sdk/authentication#ably-jwt). See [our authentication documentation](/docs/auth) for details of the Ably TokenRequest format and associated API calls. | `Callable` | +| key | The full key string, as obtained from the [application dashboard](https://ably.com/dashboard). Use this option if you wish to use Basic authentication, or wish to be able to issue Ably Tokens without needing to defer to a separate entity to sign Ably TokenRequests. Read more about [Basic authentication](/docs/platform/auth/basic) | `String` | +| token | An authenticated token. This can either be a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) object, a [`TokenRequest`](/docs/api/realtime-sdk/types#token-request) object, or token string (obtained from the `token` property of a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) component of an Ably TokenRequest response, or a [JSON Web Token](https://tools.ietf.org/html/rfc7519) satisfying [the Ably requirements for JWTs](/docs/platform/auth/token#jwt)). This option is mostly useful for testing: since tokens are short-lived, in production you almost always want to use an authentication method that allows the client library to renew the token automatically when the previous one expires, such as `authUrl` or `authCallback`. Read more about [Token authentication](/docs/platform/auth/token) | `String`, `TokenDetails` or `TokenRequest` | +| authCallback | A function which is called when a new token is required. The role of the callback is to obtain a fresh token, one of: an Ably Token string (in plain text format); a signed [`TokenRequest`](/docs/api/realtime-sdk/types#token-request); a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) (in JSON format); an [Ably JWT](/docs/api/realtime-sdk/authentication#ably-jwt). See [our authentication documentation](/docs/platform/auth) for details of the Ably TokenRequest format and associated API calls. | `Callable` | | authUrl | A URL that the library may use to obtain a fresh token, one of: an Ably Token string (in plain text format); a signed [`TokenRequest`](/docs/api/realtime-sdk/types#token-request); a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) (in JSON format); an [Ably JWT](/docs/api/realtime-sdk/authentication#ably-jwt). For example, this can be used by a client to obtain signed Ably TokenRequests from an application server. | `String` | | authMethod | The HTTP verb to use for the request, either `GET` or `POST`. The default is `GET`. | `String` | | authHeaders | A set of key value pair headers to be added to any request made to the `authUrl`. Useful when an application requires these to be added to validate the request or implement the response. | Associative Array | | authParams | A set of key value pair params to be added to any request made to the `authUrl`. When the `authMethod` is `GET`, query params are added to the URL, whereas when `authMethod` is `POST`, the params are sent as URL encoded form data. Useful when an application require these to be added to validate the request or implement the response. | Associative Array | -| tokenDetails | An authenticated [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) object (most commonly obtained from an Ably Token Request response). This option is mostly useful for testing: since tokens are short-lived, in production you almost always want to use an authentication method that allows the client library to renew the token automatically when the previous one expires, such as `authUrl` or `authCallback`. Use this option if you wish to use Token authentication. Read more about [Token authentication](/docs/auth/token) | `TokenDetails` | +| tokenDetails | An authenticated [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) object (most commonly obtained from an Ably Token Request response). This option is mostly useful for testing: since tokens are short-lived, in production you almost always want to use an authentication method that allows the client library to renew the token automatically when the previous one expires, such as `authUrl` or `authCallback`. Use this option if you wish to use Token authentication. Read more about [Token authentication](/docs/platform/auth/token) | `TokenDetails` | | tls | A boolean value, indicating whether or not a TLS ("SSL") secure connection should be used. An insecure connection cannot be used with Basic authentication as it would lead to a possible compromise of the private API key while in transit. [Find out more about TLS](https://faqs.ably.com/are-messages-sent-to-and-received-from-ably-securely-using-tls). The default is true. | `Boolean` | -| clientId | A client ID, used for identifying this client when publishing messages or for presence purposes. The `clientId` can be any non-empty string. This option is primarily intended to be used in situations where the library is instantiated with a key; note that a `clientId` may also be implicit in a token used to instantiate the library; an error will be raised if a `clientId` specified here conflicts with the `clientId` implicit in the token. [Find out more about client identities](/docs/auth/identified-clients) | `String` | -| useTokenAuth | When true, forces [Token authentication](/docs/auth/token) to be used by the library. Please note that if a `clientId` is not specified in the [`ClientOptions`](/docs/api/realtime-sdk/types#client-options) or [`TokenParams`](/docs/api/realtime-sdk/types#token-params), then the Ably Token issued will be [anonymous](https://faqs.ably.com/authenticated-and-identified-clients). The default is false. | `Boolean` | +| clientId | A client ID, used for identifying this client when publishing messages or for presence purposes. The `clientId` can be any non-empty string. This option is primarily intended to be used in situations where the library is instantiated with a key; note that a `clientId` may also be implicit in a token used to instantiate the library; an error will be raised if a `clientId` specified here conflicts with the `clientId` implicit in the token. [Find out more about client identities](/docs/platform/auth/identified-clients) | `String` | +| useTokenAuth | When true, forces [Token authentication](/docs/platform/auth/token) to be used by the library. Please note that if a `clientId` is not specified in the [`ClientOptions`](/docs/api/realtime-sdk/types#client-options) or [`TokenParams`](/docs/api/realtime-sdk/types#token-params), then the Ably Token issued will be [anonymous](https://faqs.ably.com/authenticated-and-identified-clients). The default is false. | `Boolean` | | endpoint | Enables [enterprise customers](https://ably.com/pricing) to use their own custom endpoints, which support dedicated, isolated clusters and regional message routing and storage constraints. See our [platform customization guide](/docs/platform/account/enterprise-customization) for more details. The default is null. | `String` | | environment | Deprecated, use `endpoint`. Enables [enterprise customers](https://ably.com/pricing) to use their own custom environments, which support dedicated, isolated clusters and regional message routing and storage constraints. See our [platform customization guide](/docs/platform/account/enterprise-customization) for more details. The default is null. | `String` | | idempotentRestPublishing | When true, enables idempotent publishing by assigning a unique message ID client-side, allowing the Ably servers to discard automatic publish retries following a failure such as a network fault. We recommend you enable this by default. In version 1.2 onwards, idempotent publishing for retries will be enabled by default. The default is false. | `Boolean` | @@ -2028,7 +2028,7 @@ A `TokenRevocationFailureResult` contains information about the result of an uns | logLevel | A number controlling the verbosity of the output from 1 (minimum, errors only) to 4 (most verbose). The default is `Log::WARNING`. | `Integer` | | logHandler | A function to handle each line of log output. If handler is not specified, `console.log` is used. Note that the log level and log handler have global scope in the library and will therefore not act independently between library instances when multiple library instances exist concurrently. The default is `console.log`. | `Function` | | useBinaryProtocol | If set to false, will forcibly disable the binary protocol (MessagePack). The binary protocol is used by default unless it is not supported. The default is true. Note: The binary protocol is currently not supported in PHP. Find out more about the [benefits of binary encoding](https://faqs.ably.com/do-you-binary-encode-your-messages-for-greater-efficiency) | `Boolean` | -| queryTime | If true, the library will query the Ably servers for the current time when [issuing TokenRequests](/docs/auth/token) instead of relying on a locally-available time of day. Knowing the time accurately is needed to create valid signed Ably [TokenRequests](/docs/api/rest-sdk/authentication#token-request), so this option is useful for library instances on auth servers where for some reason the server clock cannot be kept synchronized through normal means, such as an [NTP daemon](https://en.wikipedia.org/wiki/Ntpd). The server is queried for the current time once per client library instance (which stores the offset from the local clock), so if using this option you should avoid instancing a new version of the library for each request. The default is false. | `Boolean` | +| queryTime | If true, the library will query the Ably servers for the current time when [issuing TokenRequests](/docs/platform/auth/token) instead of relying on a locally-available time of day. Knowing the time accurately is needed to create valid signed Ably [TokenRequests](/docs/api/rest-sdk/authentication#token-request), so this option is useful for library instances on auth servers where for some reason the server clock cannot be kept synchronized through normal means, such as an [NTP daemon](https://en.wikipedia.org/wiki/Ntpd). The server is queried for the current time once per client library instance (which stores the offset from the local clock), so if using this option you should avoid instancing a new version of the library for each request. The default is false. | `Boolean` | | defaultTokenParams | When a [TokenParams](/docs/api/rest-sdk/types#token-params) object is provided, it will override the client library defaults when issuing new [Ably Tokens](/docs/api/realtime-sdk/authentication#token-details) or [Ably TokenRequests](/docs/api/rest-sdk/authentication#token-request) | [`TokenParams`](/docs/api/rest-sdk/types#token-params) | @@ -2036,24 +2036,24 @@ A `TokenRevocationFailureResult` contains information about the result of an uns | Parameter | Description | Type | |-----------|-------------|------| -| key | The full key string, as obtained from the [application dashboard](https://ably.com/dashboard). Use this option if you wish to use Basic authentication, or wish to be able to issue Ably Tokens without needing to defer to a separate entity to sign Ably TokenRequests. Read more about [Basic authentication](/docs/auth/basic) | `String` | -| token | An authenticated token. This can either be a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) object, a [`TokenRequest`](/docs/api/realtime-sdk/types#token-request) object, or token string (obtained from the `token` property of a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) component of an Ably TokenRequest response, or a [JSON Web Token](https://tools.ietf.org/html/rfc7519) satisfying [the Ably requirements for JWTs](/docs/auth/token#jwt)). This option is mostly useful for testing: since tokens are short-lived, in production you almost always want to use an authentication method that allows the client library to renew the token automatically when the previous one expires, such as `auth_url` or `auth_callback`. Read more about [Token authentication](/docs/auth/token) | `String`, `TokenDetails` or `TokenRequest` | -| auth_callback | A callable (eg a lambda) which is called when a new token is required. The role of the callback is to obtain a fresh token, one of: an Ably Token string (in plain text format); a signed [`TokenRequest`](/docs/api/realtime-sdk/types#token-request); a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) (in JSON format); an [Ably JWT](/docs/api/realtime-sdk/authentication#ably-jwt). See [our authentication documentation](/docs/auth) for details of the Ably TokenRequest format and associated API calls. | `Callable` | +| key | The full key string, as obtained from the [application dashboard](https://ably.com/dashboard). Use this option if you wish to use Basic authentication, or wish to be able to issue Ably Tokens without needing to defer to a separate entity to sign Ably TokenRequests. Read more about [Basic authentication](/docs/platform/auth/basic) | `String` | +| token | An authenticated token. This can either be a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) object, a [`TokenRequest`](/docs/api/realtime-sdk/types#token-request) object, or token string (obtained from the `token` property of a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) component of an Ably TokenRequest response, or a [JSON Web Token](https://tools.ietf.org/html/rfc7519) satisfying [the Ably requirements for JWTs](/docs/platform/auth/token#jwt)). This option is mostly useful for testing: since tokens are short-lived, in production you almost always want to use an authentication method that allows the client library to renew the token automatically when the previous one expires, such as `auth_url` or `auth_callback`. Read more about [Token authentication](/docs/platform/auth/token) | `String`, `TokenDetails` or `TokenRequest` | +| auth_callback | A callable (eg a lambda) which is called when a new token is required. The role of the callback is to obtain a fresh token, one of: an Ably Token string (in plain text format); a signed [`TokenRequest`](/docs/api/realtime-sdk/types#token-request); a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) (in JSON format); an [Ably JWT](/docs/api/realtime-sdk/authentication#ably-jwt). See [our authentication documentation](/docs/platform/auth) for details of the Ably TokenRequest format and associated API calls. | `Callable` | | auth_url | A URL that the library may use to obtain a fresh token, one of: an Ably Token string (in plain text format); a signed [`TokenRequest`](/docs/api/realtime-sdk/types#token-request); a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) (in JSON format); an [Ably JWT](/docs/api/realtime-sdk/authentication#ably-jwt). For example, this can be used by a client to obtain signed Ably TokenRequests from an application server. | `String` | | auth_method | The HTTP verb to use for the request, either `GET` or `POST`. The default is `GET`. | `String` | | auth_headers | A set of key value pair headers to be added to any request made to the `authUrl`. Useful when an application requires these to be added to validate the request or implement the response. | `Dict` | | auth_params | A set of key value pair params to be added to any request made to the `authUrl`. When the `auth_method` is `GET`, query params are added to the URL, whereas when `auth_method` is `POST`, the params are sent as URL encoded form data. Useful when an application require these to be added to validate the request or implement the response. | `Object` | -| token_details | An authenticated [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) object (most commonly obtained from an Ably Token Request response). This option is mostly useful for testing: since tokens are short-lived, in production you almost always want to use an authentication method that allows the client library to renew the token automatically when the previous one expires, such as `auth_url` or `auth_callback`. Use this option if you wish to use Token authentication. Read more about [Token authentication](/docs/auth/token) | `TokenDetails` | +| token_details | An authenticated [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) object (most commonly obtained from an Ably Token Request response). This option is mostly useful for testing: since tokens are short-lived, in production you almost always want to use an authentication method that allows the client library to renew the token automatically when the previous one expires, such as `auth_url` or `auth_callback`. Use this option if you wish to use Token authentication. Read more about [Token authentication](/docs/platform/auth/token) | `TokenDetails` | | tls | A boolean value, indicating whether or not a TLS ("SSL") secure connection should be used. An insecure connection cannot be used with Basic authentication as it would lead to a possible compromise of the private API key while in transit. [Find out more about TLS](https://faqs.ably.com/are-messages-sent-to-and-received-from-ably-securely-using-tls). The default is true. | `Boolean` | -| client_id | A client ID, used for identifying this client when publishing messages or for presence purposes. The `client_id` can be any non-empty string. This option is primarily intended to be used in situations where the library is instantiated with a key; note that a `client_id` may also be implicit in a token used to instantiate the library; an error will be raised if a `client_id` specified here conflicts with the `client_id` implicit in the token. [Find out more about client identities](/docs/auth/identified-clients) | `String` | -| use_token_auth | When true, forces [Token authentication](/docs/auth/token) to be used by the library. Please note that if a `client_id` is not specified in the [`ClientOptions`](/docs/api/realtime-sdk/types#client-options) or [`TokenParams`](/docs/api/realtime-sdk/types#token-params), then the Ably Token issued will be [anonymous](https://faqs.ably.com/authenticated-and-identified-clients). The default is false. | `Boolean` | +| client_id | A client ID, used for identifying this client when publishing messages or for presence purposes. The `client_id` can be any non-empty string. This option is primarily intended to be used in situations where the library is instantiated with a key; note that a `client_id` may also be implicit in a token used to instantiate the library; an error will be raised if a `client_id` specified here conflicts with the `client_id` implicit in the token. [Find out more about client identities](/docs/platform/auth/identified-clients) | `String` | +| use_token_auth | When true, forces [Token authentication](/docs/platform/auth/token) to be used by the library. Please note that if a `client_id` is not specified in the [`ClientOptions`](/docs/api/realtime-sdk/types#client-options) or [`TokenParams`](/docs/api/realtime-sdk/types#token-params), then the Ably Token issued will be [anonymous](https://faqs.ably.com/authenticated-and-identified-clients). The default is false. | `Boolean` | | endpoint | Enables [enterprise customers](https://ably.com/pricing) to use their own custom endpoints, which support dedicated, isolated clusters and regional message routing and storage constraints. See our [platform customization guide](/docs/platform/account/enterprise-customization) for more details. The default is None. | `String` | | environment | Deprecated, use `endpoint`. Enables [enterprise customers](https://ably.com/pricing) to use their own custom environments, which support dedicated, isolated clusters and regional message routing and storage constraints. See our [platform customization guide](/docs/platform/account/enterprise-customization) for more details. The default is None. | `String` | | idempotent_rest_publishing | When true, enables idempotent publishing by assigning a unique message ID client-side, allowing the Ably servers to discard automatic publish retries following a failure such as a network fault. We recommend you enable this by default. In version 1.2 onwards, idempotent publishing for retries will be enabled by default. The default is false. | `Boolean` | | fallback_hosts | An array of fallback hosts to be used in the case of an error necessitating the use of an alternative host. When a custom environment is specified, the [fallback host functionality](https://faqs.ably.com/routing-around-network-and-dns-issues) is disabled. If your customer success manager has provided you with a set of custom fallback hosts, please specify them here. The default is `[a.ably-realtime.com, b.ably-realtime.com, c.ably-realtime.com, d.ably-realtime.com, e.ably-realtime.com]`. | `String []` | | transport_params | Optional. Can be used to pass in arbitrary connection parameters, such as [`heartbeatInterval`](/docs/connect#heartbeats) and [`remainPresentFor`](/docs/presence-occupancy/presence#unstable-connections) | `Dict` | | use_binary_protocol | If set to false, will forcibly disable the binary protocol (MessagePack). The binary protocol is used by default unless it is not supported. The default is true. Find out more about the [benefits of binary encoding](https://faqs.ably.com/do-you-binary-encode-your-messages-for-greater-efficiency) | `Boolean` | -| query_time | If true, the library will query the Ably servers for the current time when [issuing TokenRequests](/docs/auth/token) instead of relying on a locally-available time of day. Knowing the time accurately is needed to create valid signed Ably [TokenRequests](/docs/api/rest-sdk/authentication#token-request), so this option is useful for library instances on auth servers where for some reason the server clock cannot be kept synchronized through normal means, such as an [NTP daemon](https://en.wikipedia.org/wiki/Ntpd). The server is queried for the current time once per client library instance (which stores the offset from the local clock), so if using this option you should avoid instancing a new version of the library for each request. The default is false. | `Boolean` | +| query_time | If true, the library will query the Ably servers for the current time when [issuing TokenRequests](/docs/platform/auth/token) instead of relying on a locally-available time of day. Knowing the time accurately is needed to create valid signed Ably [TokenRequests](/docs/api/rest-sdk/authentication#token-request), so this option is useful for library instances on auth servers where for some reason the server clock cannot be kept synchronized through normal means, such as an [NTP daemon](https://en.wikipedia.org/wiki/Ntpd). The server is queried for the current time once per client library instance (which stores the offset from the local clock), so if using this option you should avoid instancing a new version of the library for each request. The default is false. | `Boolean` | | default_token_params | When a [TokenParams](/docs/api/rest-sdk/types#token-params) object is provided, it will override the client library defaults when issuing new [Ably Tokens](/docs/api/realtime-sdk/authentication#token-details) or [Ably TokenRequests](/docs/api/rest-sdk/authentication#token-request) | [`TokenParams`](/docs/api/rest-sdk/types#token-params) | @@ -2062,24 +2062,24 @@ A `TokenRevocationFailureResult` contains information about the result of an uns | Parameter | Description | Type | |-----------|-------------|------| -| key | The full key string, as obtained from the [application dashboard](https://ably.com/dashboard). Use this option if you wish to use Basic authentication, or wish to be able to issue Ably Tokens without needing to defer to a separate entity to sign Ably TokenRequests. Read more about [Basic authentication](/docs/auth/basic) | `String` | -| token | An authenticated token. This can either be a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) object, a [`TokenRequest`](/docs/api/realtime-sdk/types#token-request) object, or token string (obtained from the `token` property of a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) component of an Ably TokenRequest response, or a [JSON Web Token](https://tools.ietf.org/html/rfc7519) satisfying [the Ably requirements for JWTs](/docs/auth/token#jwt)). This option is mostly useful for testing: since tokens are short-lived, in production you almost always want to use an authentication method that allows the client library to renew the token automatically when the previous one expires, such as `authUrl` or `authCallback`. Read more about [Token authentication](/docs/auth/token) | `String`, `TokenDetails` or `TokenRequest` | -| authCallback | A function which is called when a new token is required. The role of the callback is to obtain a fresh token, one of: an Ably Token string (in plain text format); a signed [`TokenRequest`](/docs/api/realtime-sdk/types#token-request); a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) (in JSON format); an [Ably JWT](/docs/api/realtime-sdk/authentication#ably-jwt). See [our authentication documentation](/docs/auth) for details of the Ably TokenRequest format and associated API calls. | `Callable` | +| key | The full key string, as obtained from the [application dashboard](https://ably.com/dashboard). Use this option if you wish to use Basic authentication, or wish to be able to issue Ably Tokens without needing to defer to a separate entity to sign Ably TokenRequests. Read more about [Basic authentication](/docs/platform/auth/basic) | `String` | +| token | An authenticated token. This can either be a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) object, a [`TokenRequest`](/docs/api/realtime-sdk/types#token-request) object, or token string (obtained from the `token` property of a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) component of an Ably TokenRequest response, or a [JSON Web Token](https://tools.ietf.org/html/rfc7519) satisfying [the Ably requirements for JWTs](/docs/platform/auth/token#jwt)). This option is mostly useful for testing: since tokens are short-lived, in production you almost always want to use an authentication method that allows the client library to renew the token automatically when the previous one expires, such as `authUrl` or `authCallback`. Read more about [Token authentication](/docs/platform/auth/token) | `String`, `TokenDetails` or `TokenRequest` | +| authCallback | A function which is called when a new token is required. The role of the callback is to obtain a fresh token, one of: an Ably Token string (in plain text format); a signed [`TokenRequest`](/docs/api/realtime-sdk/types#token-request); a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) (in JSON format); an [Ably JWT](/docs/api/realtime-sdk/authentication#ably-jwt). See [our authentication documentation](/docs/platform/auth) for details of the Ably TokenRequest format and associated API calls. | `Callable` | | authUrl | A URL that the library may use to obtain a fresh token, one of: an Ably Token string (in plain text format); a signed [`TokenRequest`](/docs/api/realtime-sdk/types#token-request); a [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) (in JSON format); an [Ably JWT](/docs/api/realtime-sdk/authentication#ably-jwt). For example, this can be used by a client to obtain signed Ably TokenRequests from an application server. | `String` | | authMethod | The HTTP verb to use for the request, either `GET` or `POST`. The default is `GET`. | `String` | | authHeaders | A set of key value pair headers to be added to any request made to the `authUrl`. Useful when an application requires these to be added to validate the request or implement the response. | `Map` | | authParams | A set of key value pair params to be added to any request made to the `authUrl`. When the `authMethod` is `GET`, query params are added to the URL, whereas when `authMethod` is `POST`, the params are sent as URL encoded form data. Useful when an application require these to be added to validate the request or implement the response. | `Map` | -| tokenDetails | An authenticated [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) object (most commonly obtained from an Ably Token Request response). This option is mostly useful for testing: since tokens are short-lived, in production you almost always want to use an authentication method that allows the client library to renew the token automatically when the previous one expires, such as `authUrl` or `authCallback`. Use this option if you wish to use Token authentication. Read more about [Token authentication](/docs/auth/token) | `TokenDetails` | +| tokenDetails | An authenticated [`TokenDetails`](/docs/api/realtime-sdk/types#token-details) object (most commonly obtained from an Ably Token Request response). This option is mostly useful for testing: since tokens are short-lived, in production you almost always want to use an authentication method that allows the client library to renew the token automatically when the previous one expires, such as `authUrl` or `authCallback`. Use this option if you wish to use Token authentication. Read more about [Token authentication](/docs/platform/auth/token) | `TokenDetails` | | tls | A boolean value, indicating whether or not a TLS ("SSL") secure connection should be used. An insecure connection cannot be used with Basic authentication as it would lead to a possible compromise of the private API key while in transit. [Find out more about TLS](https://faqs.ably.com/are-messages-sent-to-and-received-from-ably-securely-using-tls). The default is true. | `Boolean` | -| clientId | A client ID, used for identifying this client when publishing messages or for presence purposes. The `clientId` can be any non-empty string. This option is primarily intended to be used in situations where the library is instantiated with a key; note that a `clientId` may also be implicit in a token used to instantiate the library; an error will be raised if a `clientId` specified here conflicts with the `clientId` implicit in the token. [Find out more about client identities](/docs/auth/identified-clients) | `String` | -| useTokenAuth | When true, forces [Token authentication](/docs/auth/token) to be used by the library. Please note that if a `clientId` is not specified in the [`ClientOptions`](/docs/api/realtime-sdk/types#client-options) or [`TokenParams`](/docs/api/realtime-sdk/types#token-params), then the Ably Token issued will be [anonymous](https://faqs.ably.com/authenticated-and-identified-clients). The default is false. | `Boolean` | +| clientId | A client ID, used for identifying this client when publishing messages or for presence purposes. The `clientId` can be any non-empty string. This option is primarily intended to be used in situations where the library is instantiated with a key; note that a `clientId` may also be implicit in a token used to instantiate the library; an error will be raised if a `clientId` specified here conflicts with the `clientId` implicit in the token. [Find out more about client identities](/docs/platform/auth/identified-clients) | `String` | +| useTokenAuth | When true, forces [Token authentication](/docs/platform/auth/token) to be used by the library. Please note that if a `clientId` is not specified in the [`ClientOptions`](/docs/api/realtime-sdk/types#client-options) or [`TokenParams`](/docs/api/realtime-sdk/types#token-params), then the Ably Token issued will be [anonymous](https://faqs.ably.com/authenticated-and-identified-clients). The default is false. | `Boolean` | | endpoint | Enables [enterprise customers](https://ably.com/pricing) to use their own custom endpoints, which support dedicated, isolated clusters and regional message routing and storage constraints. See our [platform customization guide](/docs/platform/account/enterprise-customization) for more details. The default is null. | `String` | | environment | Deprecated, use `endpoint`. Enables [enterprise customers](https://ably.com/pricing) to use their own custom environments, which support dedicated, isolated clusters and regional message routing and storage constraints. See our [platform customization guide](/docs/platform/account/enterprise-customization) for more details. The default is null. | `String` | | idempotentRestPublishing | When true, enables idempotent publishing by assigning a unique message ID client-side, allowing the Ably servers to discard automatic publish retries following a failure such as a network fault. We recommend you enable this by default. In version 1.2 onwards, idempotent publishing for retries will be enabled by default. The default is false. | `Boolean` | | fallbackHosts | An array of fallback hosts to be used in the case of an error necessitating the use of an alternative host. When a custom environment is specified, the [fallback host functionality](https://faqs.ably.com/routing-around-network-and-dns-issues) is disabled. If your customer success manager has provided you with a set of custom fallback hosts, please specify them here. The default is `[a.ably-realtime.com, b.ably-realtime.com, c.ably-realtime.com, d.ably-realtime.com, e.ably-realtime.com]`. | `String []` | | transportParams | Optional. Can be used to pass in arbitrary connection parameters, such as [`heartbeatInterval`](/docs/connect#heartbeats) and [`remainPresentFor`](/docs/presence-occupancy/presence#unstable-connections) | `Map` | | useBinaryProtocol | If set to false, will forcibly disable the binary protocol (MessagePack). The binary protocol is used by default unless it is not supported. The default is true. Find out more about the [benefits of binary encoding](https://faqs.ably.com/do-you-binary-encode-your-messages-for-greater-efficiency) | `Boolean` | -| queryTime | If true, the library will query the Ably servers for the current time when [issuing TokenRequests](/docs/auth/token) instead of relying on a locally-available time of day. Knowing the time accurately is needed to create valid signed Ably [TokenRequests](/docs/api/rest-sdk/authentication#token-request), so this option is useful for library instances on auth servers where for some reason the server clock cannot be kept synchronized through normal means, such as an [NTP daemon](https://en.wikipedia.org/wiki/Ntpd). The server is queried for the current time once per client library instance (which stores the offset from the local clock), so if using this option you should avoid instancing a new version of the library for each request. The default is false. | `Boolean` | +| queryTime | If true, the library will query the Ably servers for the current time when [issuing TokenRequests](/docs/platform/auth/token) instead of relying on a locally-available time of day. Knowing the time accurately is needed to create valid signed Ably [TokenRequests](/docs/api/rest-sdk/authentication#token-request), so this option is useful for library instances on auth servers where for some reason the server clock cannot be kept synchronized through normal means, such as an [NTP daemon](https://en.wikipedia.org/wiki/Ntpd). The server is queried for the current time once per client library instance (which stores the offset from the local clock), so if using this option you should avoid instancing a new version of the library for each request. The default is false. | `Boolean` | | defaultTokenParams | When a [TokenParams](/docs/api/rest-sdk/types#token-params) object is provided, it will override the client library defaults when issuing new [Ably Tokens](/docs/api/realtime-sdk/authentication#token-details) or [Ably TokenRequests](/docs/api/rest-sdk/authentication#token-request) | [`TokenParams`](/docs/api/rest-sdk/types#token-params) | @@ -2215,32 +2215,32 @@ Individual client libraries may support either instancing a `CipherParams` direc -`TokenParams` is a plain JavaScript object and is used in the parameters of [token authentication](/docs/auth/token) requests, corresponding to the desired attributes of the [Ably Token](/docs/api/realtime-sdk/authentication#token-details). The following attributes can be defined on the object: +`TokenParams` is a plain JavaScript object and is used in the parameters of [token authentication](/docs/platform/auth/token) requests, corresponding to the desired attributes of the [Ably Token](/docs/api/realtime-sdk/authentication#token-details). The following attributes can be defined on the object: -`TokenParams` is a Hash object and is used in the parameters of [token authentication](/docs/auth/token) requests, corresponding to the desired attributes of the [Ably Token](/docs/api/realtime-sdk/authentication#token-details). The following key symbol values can be added to the Hash: +`TokenParams` is a Hash object and is used in the parameters of [token authentication](/docs/platform/auth/token) requests, corresponding to the desired attributes of the [Ably Token](/docs/api/realtime-sdk/authentication#token-details). The following key symbol values can be added to the Hash: -`TokenParams` is a Dict and is used in the parameters of [token authentication](/docs/auth/token) requests, corresponding to the desired attributes of the [Ably Token](/docs/api/realtime-sdk/authentication#token-details). The following keys-value pairs can be added to the Dict: +`TokenParams` is a Dict and is used in the parameters of [token authentication](/docs/platform/auth/token) requests, corresponding to the desired attributes of the [Ably Token](/docs/api/realtime-sdk/authentication#token-details). The following keys-value pairs can be added to the Dict: -`TokenParams` is an Associative Array and is used in the parameters of [token authentication](/docs/auth/token) requests, corresponding to the desired attributes of the [Ably Token](/docs/api/realtime-sdk/authentication#token-details). The following named keys and values can be added to the Associative Array: +`TokenParams` is an Associative Array and is used in the parameters of [token authentication](/docs/platform/auth/token) requests, corresponding to the desired attributes of the [Ably Token](/docs/api/realtime-sdk/authentication#token-details). The following named keys and values can be added to the Associative Array: -`TokenParams` is used in the parameters of [token authentication](/docs/auth/token) requests, corresponding to the desired attributes of the [Ably Token](/docs/api/realtime-sdk/authentication#token-details). +`TokenParams` is used in the parameters of [token authentication](/docs/platform/auth/token) requests, corresponding to the desired attributes of the [Ably Token](/docs/api/realtime-sdk/authentication#token-details). -`ARTTokenParams` is used in the parameters of [token authentication](/docs/auth/token) requests, corresponding to the desired attributes of the [Ably Token](/docs/api/realtime-sdk/authentication#token-details). +`ARTTokenParams` is used in the parameters of [token authentication](/docs/platform/auth/token) requests, corresponding to the desired attributes of the [Ably Token](/docs/api/realtime-sdk/authentication#token-details). @@ -2248,8 +2248,8 @@ Individual client libraries may support either instancing a `CipherParams` direc | Parameter | Description | Type | |-----------|-------------|------| -| capabilityCapability:capability | JSON stringified capability of the [Ably Token](/docs/api/realtime-sdk/authentication#token-details). If the [Ably Token](/docs/api/realtime-sdk/authentication#token-details) request is successful, the capability of the returned [Ably Token](/docs/api/realtime-sdk/authentication#token-details) will be the intersection of this capability with the capability of the issuing key. [Find our more about how to use capabilities to manage access privileges for clients](/docs/auth/capabilities). | `String``Capability` | -| clientIdClientIdclient_id:client_id | A client ID, used for identifying this client when publishing messages or for presence purposes. The `clientId``client_id``ClientId` can be any non-empty string. This option is primarily intended to be used in situations where the library is instantiated with a key; note that a `clientId``client_id``ClientId` may also be implicit in a token used to instantiate the library; an error will be raised if a `clientId``client_id``ClientId` specified here conflicts with the `clientId``client_id``ClientId` implicit in the token. [Find out more about client identities](/docs/auth/identified-clients) | `String` | +| capabilityCapability:capability | JSON stringified capability of the [Ably Token](/docs/api/realtime-sdk/authentication#token-details). If the [Ably Token](/docs/api/realtime-sdk/authentication#token-details) request is successful, the capability of the returned [Ably Token](/docs/api/realtime-sdk/authentication#token-details) will be the intersection of this capability with the capability of the issuing key. [Find our more about how to use capabilities to manage access privileges for clients](/docs/platform/auth/capabilities). | `String``Capability` | +| clientIdClientIdclient_id:client_id | A client ID, used for identifying this client when publishing messages or for presence purposes. The `clientId``client_id``ClientId` can be any non-empty string. This option is primarily intended to be used in situations where the library is instantiated with a key; note that a `clientId``client_id``ClientId` may also be implicit in a token used to instantiate the library; an error will be raised if a `clientId``client_id``ClientId` specified here conflicts with the `clientId``client_id``ClientId` implicit in the token. [Find out more about client identities](/docs/platform/auth/identified-clients) | `String` | | nonceNonce:nonce | An optional opaque nonce string of at least 16 characters to ensure uniqueness of this request. Any subsequent request using the same nonce will be rejected. | `String` | | timestampTimestamp:timestamp | The timestamp (in milliseconds since the epoch)The timestamp of this request. `timestamp`, in conjunction with the `nonce`, is used to prevent requests for [Ably Token](/docs/api/realtime-sdk/authentication#token-details) from being replayed. | `Integer``Long Integer``Time``NSDate``DateTimeOffset``DateTime` | | ttlTtl:ttl | Requested time to live for the [Ably Token](/docs/api/realtime-sdk/authentication#token-details) being created in millisecondsin secondsas a `NSTimeInterval`as a `TimeSpan`. When omitted, the Ably REST API default of 60 minutes is applied by Ably. The default is 1 hour. | `Integer` (milliseconds)`Integer` (seconds)`NSTimeInterval``Long Integer``TimeSpan` | diff --git a/src/pages/docs/api/token-request-spec.mdx b/src/pages/docs/api/token-request-spec.mdx index 5f447a50d4..52143f1526 100644 --- a/src/pages/docs/api/token-request-spec.mdx +++ b/src/pages/docs/api/token-request-spec.mdx @@ -9,7 +9,7 @@ redirect_from: - /docs/rest-api/versions/v1.0/token-request-spec --- -The [Ably REST and Realtime client libraries](https://ably.com/download/) aim to make things as simple as possible so it is not necessary to understand all of the details of how to interact with the service and issue tokens for clients. If you wish to issue Ably-compatible tokens or [Ably TokenRequests](/docs/api/realtime-sdk/types#token-request), we recommend you start with the [client library authentication documentation](/docs/auth). +The [Ably REST and Realtime client libraries](https://ably.com/download/) aim to make things as simple as possible so it is not necessary to understand all of the details of how to interact with the service and issue tokens for clients. If you wish to issue Ably-compatible tokens or [Ably TokenRequests](/docs/api/realtime-sdk/types#token-request), we recommend you start with the [client library authentication documentation](/docs/platform/auth). However, if you are using the [REST API token endpoint directly](/docs/api/rest-api/#request-token), or if you are creating Ably `TokenRequests` without the use of our client libraries, then the following specification will give you an in-depth understanding of how getting Ably Tokens works. @@ -81,9 +81,9 @@ The following capability operations are available for API keys and issued tokens | channel-metadata | Can get metadata for a channel, and enumerate channels | | privileged-headers | Can set data in the privileged section of the [message extras](/docs/api/realtime-sdk/messages#extras) | -Read the [capabilities docs](/docs/auth/capabilities) to get a more thorough overview of how capabilities can be used to secure your application. +Read the [capabilities docs](/docs/platform/auth/capabilities) to get a more thorough overview of how capabilities can be used to secure your application. -While most of these capabilities need to be enabled for the resource you're using them with, as described in [resource names and wildcards](/docs/auth/capabilities#wildcards), there are exceptions. The `stats` permission only does something when attached to the wildcard resource `'*'`, or a resource that contains that as a subset, such as `'[*]*'`, since stats are app-wide. +While most of these capabilities need to be enabled for the resource you're using them with, as described in [resource names and wildcards](/docs/platform/auth/capabilities#wildcards), there are exceptions. The `stats` permission only does something when attached to the wildcard resource `'*'`, or a resource that contains that as a subset, such as `'[*]*'`, since stats are app-wide. The `channel-metadata` permission works both ways. When associated with a specific channel or set of channels it allows you to [query the metadata of a channel](/docs/metadata-stats/metadata/rest) to request its status. When associated with the wildcard resource `'*'` it takes on an additional meaning: as well as allowing channel status requests for all channels, it also allows you to [enumerate all active channels](/docs/metadata-stats/metadata/rest#enumerate). diff --git a/src/pages/docs/auth/identified-clients.mdx b/src/pages/docs/auth/identified-clients.mdx deleted file mode 100644 index e4754fa566..0000000000 --- a/src/pages/docs/auth/identified-clients.mdx +++ /dev/null @@ -1,218 +0,0 @@ ---- -title: Identified clients -meta_description: "Clients can be allocated a client ID to help control their operations and interactions with Ably channels." ---- - -When a client is authenticated and connected to Ably, it is considered to be an authenticated client. While an authenticated client has a means to authenticate with Ably, they do not necessarily have an identity. - -When a client is assigned a trusted identity, that is, a `clientId`, then they are considered to be an identified client. For all operations that client performs with the Ably service, their `clientId` field will be automatically populated and can be trusted by other clients. - -For example, assume you are building a chat application and want to allow clients to publish messages and be present on a channel. If each client is assigned a trusted identity by your server, such as a unique email address or UUID, then all other subscribed clients can trust any messages or presence events they receive in the channel as being from that client. No other clients are permitted to assume a `clientId` that they are not assigned in their Ably-compatible token. They are unable to masquerade as another `clientId`. - -## ClientId immutability - -A connection's `clientId`, once set, is immutable. You cannot change a `clientId` after it has been established for a connection. - -### Late initialization - -It is possible to have late initialization of `clientId` in certain scenarios: - -* AuthCallback discovery: When using `authCallback`, the `clientId` may only become known when the first authCallback completes and returns a token with a `clientId`. -* Opaque token processing: When the library receives an opaque token string, it only learns the `clientId` when it receives a response from the server that has processed the token. - -In both cases, the immutability requirement is satisfied because the `clientId` gets set as part of the client's first interaction with the server. Once this initial authentication is complete, the `clientId` cannot be changed for that connection. - -## Assign a clientId - -There are three different ways a client can be identified with using a `clientId`: - -* A client claims a `clientId` when authenticating with an API key. -* A client is authenticating with a token issued for a specific `clientId`. -* A client claims a `clientId` when authenticating with a token that is issued for a wildcard `clientId`. - -When a client sets their own ID there is the possibility that they can pretend to be someone else. To prevent this, it is recommended that you embed a `clientId` in the token issued to your clients from your auth server. This ensures that the `clientId` is set by your auth server, and eliminates the chance of a client pretending to be someone else. - - - -### Basic auth - -You can use [basic authentication](/docs/auth/basic) to allow a client to claim any `clientId` when they authenticate with Ably. As the assignation of the `clientId` is not handled by a server, it cannot be trusted to represent the genuine identity of the client. - -### Token auth - -You can use [token authentication](/docs/auth/token) to set an explicit `clientId` when creating or issuing a token. Clients using that token are restricted to operations for only that `clientId`, and all operations will implicitly contain that `clientId`. - -For example, when publishing a message, the `clientId` attribute of the message will be pre-populated with that `clientId`. Entering presence will also implicitly use that `clientId`. - -The following example demonstrates how to issue an [Ably TokenRequest](/docs/auth/token#token-request) with an explicit `clientId`: - - -```realtime_javascript - const realtime = new Ably.Realtime({ key: '{{API_KEY}}' }); - const tokenRequest = await realtime.auth.createTokenRequest({ clientId: 'Bob'}); -``` - -```realtime_nodejs - const realtime = new Ably.Realtime({ key: '{{API_KEY}}' }); - const tokenRequest = await realtime.auth.createTokenRequest({ clientId: 'Bob'}); -``` - -```realtime_ruby - realtime = Ably::Realtime.new(key: '{{API_KEY}}') - realtime.auth.createTokenRequest(client_id: 'Bob') do |token_request| - # ... issue the TokenRequest to a client ... - end -``` - -```realtime_python - realtime = AblyRealtime(key='{{API_KEY}}') - token_request = await realtime.auth.create_token_request({'client_id': 'Bob'}) - # ... issue the TokenRequest to a client ... -``` - -```realtime_java - ClientOptions options = new ClientOptions(); - options.key = "{{API_KEY}}"; - AblyRealtime realtime = new AblyRealtime(options); - TokenParams tokenParams = new TokenParams(); - tokenParams.clientId = "Bob"; - TokenRequest tokenRequest; - tokenRequest = realtime.auth.createTokenRequest(tokenParams, null); - /* ... issue the TokenRequest to a client ... */ -``` - -```realtime_csharp - AblyRealtime realtime = new AblyRealtime("{{API_KEY}}"); - TokenParams tokenParams = new TokenParams {ClientId = "Bob"}; - string tokenRequest = await realtime.Auth.CreateTokenRequestAsync(tokenParams); - /* ... issue the TokenRequest to a client ... */ -``` - -```realtime_objc - ARTRealtime *realtime = [[ARTRealtime alloc] initWithKey:@"{{API_KEY}}"]; - ARTTokenParams *tokenParams = [[ARTTokenParams alloc] initWithClientId:@"Bob"]; - [realtime.auth createTokenRequest:tokenParams options:nil - callback:^(ARTTokenRequest *tokenRequest NSError *error) { - // ... issue the TokenRequest to a client ... - }]; -``` - -```realtime_swift - let realtime = ARTRealtime(key: "{{API_KEY}}") - let tokenParams = ARTTokenParams(clientId: "Bob") - realtime.auth.createTokenRequest(tokenParams, options: nil) { tokenRequest, error in - // ... issue the TokenRequest to a client ... - } -``` - -```realtime_go -realtime, _ := ably.NewRealtime( - ably.WithKey("{{API_KEY}}")) -params := &ably.TokenParams{ - ClientID: "Bob", -} -tokenRequest, _ := realtime.Auth.CreateTokenRequest(params) -``` - -```realtime_flutter -final realtime = ably.Realtime(options: ably.ClientOptions(key: '{{API_KEY}}')); -final tokenRequest = await realtime.auth.createTokenRequest( - tokenParams: ably.TokenParams(clientId: 'Bob'), -); -``` - -```rest_javascript - const rest = new Ably.Rest({ key: '{{API_KEY}}' }); - const tokenRequest = await realtime.auth.createTokenRequest({ clientId: 'Bob'}); -``` - -```rest_nodejs - const rest = new Ably.Rest({ key: '{{API_KEY}}' }); - const tokenRequest = await realtime.auth.createTokenRequest({ clientId: 'Bob'}); -``` - -```rest_ruby - rest = Ably::Rest.new(key: '{{API_KEY}}') - token_request = rest.auth.create_token_request(client_id: 'Bob') - # ... issue the TokenRequest to a client ... -``` - -```rest_python - rest = AblyRest(key='{{API_KEY}}') - token_request = await rest.auth.create_token_request({'client_id': 'Bob'}) - # ... issue the TokenRequest to a client ... -``` - -```rest_php - $rest = new Ably\AblyRest( - ['key' => '{{API_KEY}}'] - ); - $tokenRequest = $rest->auth->createTokenRequest( - ['clientId' => 'Bob'] - ); - // ... issue the TokenRequest to a client ... -``` - -```rest_java - ClientOptions options = new ClientOptions(); - options.key = "{{API_KEY}}"; - AblyRest rest = new AblyRest(options); - TokenParams tokenParams = new TokenParams(); - tokenParams.clientId = "Bob"; - TokenRequest tokenRequest; - tokenRequest = rest.auth.createTokenRequest(tokenParams, null); - /* ... issue the TokenRequest to a client ... */ -``` - -```rest_csharp - AblyRest rest = new AblyRest(new ClientOptions {Key = "{{API_KEY}}"}); - TokenParams tokenParams = new TokenParams {ClientId = "Bob"}; - string tokenRequest = await rest.Auth.CreateTokenRequestAsync(tokenParams); - // ... issue the TokenRequest to a client ... -``` - -```rest_objc - ARTRest *rest = [[ARTRest alloc] initWithKey:@"{{API_KEY}}"]; - ARTTokenParams *tokenParams = [[ARTTokenParams alloc] initWithClientId:@"Bob"]; - [rest.auth createTokenRequest:tokenParams options:nil - callback:^(ARTTokenRequest *tokenRequest, NSError *error) { - // ... issue the TokenRequest to a client ... - }]; -``` - -```rest_swift - let rest = ARTRest(key: "{{API_KEY}}") - let tokenParams = ARTTokenParams(clientId: "Bob") - rest.auth.createTokenRequest(tokenParams, options: nil) { tokenRequest, error in - // ... issue the TokenRequest to a client ... - } -``` - -```rest_go -rest, _ := ably.NewREST( - ably.WithKey("{{API_KEY}}")) -params := &ably.TokenParams{ - ClientID: "Bob", -} -tokenRequest, _ := rest.Auth.CreateTokenRequest(params) -``` - -```rest_flutter -final rest = ably.Rest(options: ably.ClientOptions(key: '{{API_KEY}}')); -final tokenRequest = await rest.auth.createTokenRequest( - tokenParams: ably.TokenParams(clientId: 'Bob'), -); -``` - - -### Wildcard token auth - -You can use [token authentication](/docs/auth/token) to set a wildcard `clientId` using a value of `*` when creating a token. Clients are then able to assume any identity in their operations, such as when publishing a message or entering presence. - -## Unidentified clients - -If no `clientId` is provided when using [token authentication](/docs/auth/token) then clients are not permitted to assume an identity and will be considered an unidentified client in all operations. Messages published will contain no `clientId` and those clients will not be permitted to enter the [presence](/docs/presence-occupancy/presence) set. diff --git a/src/pages/docs/auth/index.mdx b/src/pages/docs/auth/index.mdx deleted file mode 100644 index 51949e95e5..0000000000 --- a/src/pages/docs/auth/index.mdx +++ /dev/null @@ -1,110 +0,0 @@ ---- -title: Authentication overview -meta_description: "Ably supports two main authentication schemes: basic authentication and token authentication. Token authentication can be implemented using JWTs, Ably tokens, and Ably token requests." -redirect_from: - - /docs/rest/authentication - - /docs/rest/versions/v1.1/authentication - - /docs/rest/versions/v1.0/authentication - - /docs/rest/versions/v0.8/authentication - - /docs/realtime/authentication - - /docs/realtime/versions/v1.1/authentication - - /docs/realtime/versions/v1.0/authentication - - /docs/realtime/versions/v0.8/authentication - - /docs/core-features/authentication - - /docs/core-features/versions/v1.1/authentication - - /docs/core-features/versions/v1.0/authentication - - /docs/core-features/versions/v0.8/authentication - - /docs/core-features/authentication.ably-jwt - - /docs/general/authentication - - /docs/general/_authentication_capabilities - - /docs/ids-and-keys ---- - -Before a client or server can issue requests to Ably, such as subscribe to channels, or publish messages, it must authenticate with Ably. Authentication requires an Ably API key. - -## Authentication terminology - -The following terminology helps explain authentication, authorization, and identification in the context of the Ably service: - -"Authentication" is the process of deciding, based on the presented credentials, whether or not an entity may interact with the Ably service. The credentials may be presented explicitly using [Basic Authentication](/docs/auth/basic) or [Token Authentication](/docs/auth/token), or in some cases the entity authenticating may prove possession of the credentials with a signed Token Request that is subsequently used to generate a valid token to be used for Token Authentication. When authenticating with Ably, the credentials are either an API key or an auth token. - -"Authenticated client" is a client of the Ably service that has been successfully authenticated. - -"Authorization" is the process of deciding whether or not a given entity (usually authenticated) is allowed to perform a given operation. In Ably, authorization for most operations is based on the [capabilities](/docs/auth/capabilities) associated with the key or token that was used to authenticate a client. - -"Identified client" is an authenticated client with a specific claimed client identity, or `clientId`, whose credentials are verified as confirming that identity. See the [identified clients](/docs/auth/identified-clients) documentation for more information. - - - -## Ably API keys - -Every Ably app can have one or more API keys associated with it in order to authenticate directly with Ably, or to issue tokens with. API keys can be created with different [capabilities](/docs/auth/capabilities) and any tokens issued using that API key can only permit a subset of those capabilities. - -### API key format - -An Ably API key string has the following format: `I2E_JQ.OqUdfg:EVKVTCBlzLBPYJiCZTsIW_pqylJ9WVRB5K9P19Ap1y0`. - -The API key is made up of three parts: - -1. `I2E_JQ` is the public app ID (the part before the first period) -2. `OqUdfg` is the public app key ID (the part after the period and before the colon). `I2E_JQ.OqUdfg` is the public API key ID (both the public app ID and app key ID together) -3. `EVKVTCBlzLBPYJiCZTsIW_pqylJ9WVRB5K9P19Ap1y0` is the API key secret and should never be shared with untrusted parties (the part after the colon) - -The API key secret is private and should never be made public. This API key string is used in all Ably SDKs and for authentication with the REST API. - -### Create an API key - -API keys are created in the [Ably dashboard](https://ably.com/dashboard). You can also create an API key programmatically using the [Control API](/docs/platform/account/control-api). - -To create an API key in the Ably dashboard: - -1. In your [Ably dashboard](https://ably.com/dashboard) click the API Keys tab. -2. Click the **Create a new API key** button. -3. Enter a name for your API key - this will help you identify the specific key when you have many keys created. -4. Select the [capabilities](/docs/auth/capabilities) you want to apply to the key. Clients connecting with this key will be restricted to these capabilities. -5. Optionally you can select whether to make tokens generated from this key to be revocable or not. -6. Optionally select whether you want to restrict the scope of the key to channels, queues, or specific channels and queues using resource names and wildcards. - - - -## Available authentication mechanisms - -The two authentication mechanisms available to authenticate with Ably are: - -1. [Basic authentication](/docs/auth/basic), which uses your Ably API key directly. -2. [Token authentication](/docs/auth/token), which uses short-lived tokens for access. These tokens are periodically renewed, and can be revoked if required. - -### Client-side authentication - -[Token authentication](/docs/auth/token) is the recommended authentication mechanism on the client-side, as it provides more fine-grained access control and limits the risk of exposing your Ably API key. - -In production systems you should never use basic authentication on the client-side as it exposes your Ably API key. API keys don't have an expiry, so once compromised, they could be used indefinitely by an attacker. - -Tokens have an expiry, and so there is only a small period of time during which the compromised token can be used. It is also possible to [revoke tokens](/docs/auth/revocation), should that be necessary for security reasons. - -### Server-side authentication - -Use [basic authentication](/docs/auth/basic) on the server-side. You should never use token authentication server-side, as this results in unnecessary overhead due the server needing to periodically make token requests to authenticate itself. - -## Selecting an authentication mechanism - -When deciding on which authentication method you will be using, it is recommended you bear in mind the [principle of least privilege](https://en.wikipedia.org/wiki/Principle_of_least_privilege). - -A client should ideally only possess the credentials and rights that it needs to accomplish what it wants. This way, if the credentials are compromised, the rights that can be abused by an attacker are minimized. - -The following table provides guidelines on what to consider when choosing your authentication method. Many applications will most naturally use a mixed strategy: one or more trusted application servers will use basic authentication to access the service and issue tokens over HTTPS, whereas remote browsers and devices will use individually issued tokens: - -| Scenario | [Basic](/docs/auth/basic) | [Token](/docs/auth/token) | Description | -|----------|---------------------------|---------------------------|-------------| -| Your scripts may be exposed | No | Yes | If the script, program or system holding the key is exposed, for example on a user's device, you should not embed an API key and instead use token authentication. If the script is on a secure environment such as your own server, an API key with basic authentication is fine. | -| Your connection may be insecure | No | Yes | If there is a risk of exposure of the client's credentials, either directly or over an insecure, or insecurely proxied, connection, token authentication should be used. If you are sure the connection is secure and unmediated, basic authentication is acceptable. | -| You have no server to control access | Yes | No | If you do not have your own server to perform authentication and provide tokens to users, you'll need to use basic authentication. | -| You require fine-grained access control | No | Yes | If you need to provide [privileges](/docs/auth/capabilities) on a user-by-user basis, you'd be better using token authentication. If you only need a few access control groups, basic authentication is reasonable. | -| Users need restricted periods of access | No | Yes | If you need users to only have access for a certain period of time, or the ability to revoke access, token authentication is needed. If users are able to always have access, basic authentication is acceptable. | -| Users need to identify themselves | Partial | Yes | If the user can be trusted to [identify](/docs/auth/identified-clients) itself, basic authentication is fine. If the user cannot be trusted however, token authentication is better as it allows for a trusted token distributor to identify the user instead. | diff --git a/src/pages/docs/channels/index.mdx b/src/pages/docs/channels/index.mdx index b0b6f0695d..b9d40218a5 100644 --- a/src/pages/docs/channels/index.mdx +++ b/src/pages/docs/channels/index.mdx @@ -26,7 +26,7 @@ redirect_from: - /docs/general/versions/v0.8/channel-rules-namespaces --- -Channels are used to separate messages into different topics. They are the building block of creating a realtime application using the publish-subscribe pattern. Channels are also the unit of security and scalability. Clients should only ever be provided the [capabilities](/docs/auth/capabilities) for channels that they should have access to. +Channels are used to separate messages into different topics. They are the building block of creating a realtime application using the publish-subscribe pattern. Channels are also the unit of security and scalability. Clients should only ever be provided the [capabilities](/docs/platform/auth/capabilities) for channels that they should have access to. [Messages](/docs/channels/messages) contain the data that a client is communicating, such as the contents of an individual chat message, or an event that has occurred, such as updated financial information. @@ -151,17 +151,17 @@ A namespace is the first part of a channel name up to the first colon (`:`). If Channel namespaces have the same restrictions as those listed for channels. Additionally they cannot contain the wildcard character `*`. -Use channel namespaces to apply operations to all channels within that group, such as [capabilities](/docs/auth/capabilities), [channel rules](#rules) and [integrations](/docs/platform/integrations). +Use channel namespaces to apply operations to all channels within that group, such as [capabilities](/docs/platform/auth/capabilities), [channel rules](#rules) and [integrations](/docs/platform/integrations). ## Publishing and subscribing Clients [subscribe](/docs/pub-sub#subscribe) to a channel to receive the messages published to it. Clients can subscribe to all messages, or only messages identified by specific names. -[Publishing](/docs/pub-sub#publish) messages to a channel is how clients communicate with one another. Any subscribers will receive published messages as long as they are subscribed and have the `subscribe` [capability](/docs/auth/capabilities) for that channel. +[Publishing](/docs/pub-sub#publish) messages to a channel is how clients communicate with one another. Any subscribers will receive published messages as long as they are subscribed and have the `subscribe` [capability](/docs/platform/auth/capabilities) for that channel. ## Channel options @@ -190,7 +190,7 @@ The channel rules related to security and client identity are: | Rule | Description | |------|-------------| -| Identified | If enabled, clients will not be permitted to use (including to attach, publish, or subscribe) matching channels unless they are [identified](/docs/auth/identified-clients) (they have an assigned client ID). Anonymous clients are not permitted to join these channels. Find out more about [authenticated and identified clients](/docs/auth/identified-clients). | +| Identified | If enabled, clients will not be permitted to use (including to attach, publish, or subscribe) matching channels unless they are [identified](/docs/platform/auth/identified-clients) (they have an assigned client ID). Anonymous clients are not permitted to join these channels. Find out more about [authenticated and identified clients](/docs/platform/auth/identified-clients). | | TLS only | If enabled, only clients who have connected to Ably over TLS will be allowed to use matching channels. By default all of Ably's client libraries use TLS when communicating with Ably over REST or when using Realtime transports such as Websockets. | The channel rules related to enabling features are: diff --git a/src/pages/docs/channels/options/deltas.mdx b/src/pages/docs/channels/options/deltas.mdx index 7e6ef52956..b1cb9fc95a 100644 --- a/src/pages/docs/channels/options/deltas.mdx +++ b/src/pages/docs/channels/options/deltas.mdx @@ -100,6 +100,10 @@ This will cause delta messages to be generated by the server and sent to the cli Note that in some SDKs, the `vcdiff` delta decoding library is excluded from the default distribution in order to avoid increasing the size. In these cases, it is also necessary to supply the delta decoder plugin when instantiating Ably. + + ```realtime_javascript /* Make sure to include in your head */ diff --git a/src/pages/docs/channels/options/encryption.mdx b/src/pages/docs/channels/options/encryption.mdx index a1ba87fbdd..24bd51d3db 100644 --- a/src/pages/docs/channels/options/encryption.mdx +++ b/src/pages/docs/channels/options/encryption.mdx @@ -30,7 +30,7 @@ Disabling TLS is strongly discouraged and is enabled by default in all client li Unencrypted communication with Ably is **disallowed** if any of the following conditions are met: -* You attempt to use [Basic Authentication](/docs/auth/basic) and thus transmit a private API key over an unencrypted connection. You are only permitted to use unencrypted connections with [Token Authentication](/docs/auth/token) as tokens expire, limiting the impact of token interception. +* You attempt to use [Basic Authentication](/docs/platform/auth/basic) and thus transmit a private API key over an unencrypted connection. You are only permitted to use unencrypted connections with [Token Authentication](/docs/platform/auth/token) as tokens expire, limiting the impact of token interception. * You have specified that TLS is required in your [app settings](/docs/platform/account/app/settings). @@ -84,6 +84,10 @@ A `key` should be a cryptographic key generated from a secure random source, 128 The following is an example of setting encryption when obtaining a channel instance: + + ```realtime_javascript const realtime = new Ably.Realtime('{{API_KEY}}'); diff --git a/src/pages/docs/channels/options/index.mdx b/src/pages/docs/channels/options/index.mdx index 775798840b..35528b1a01 100644 --- a/src/pages/docs/channels/options/index.mdx +++ b/src/pages/docs/channels/options/index.mdx @@ -28,6 +28,10 @@ Pass a `channelOptions` object into the call to [`get()`](/docs/api/realtime-sdk The following is an example of setting the `cipher` property to set [encryption](/docs/channels/options/encryption) when obtaining a channel instance: + + ```realtime_javascript const realtime = new Ably.Realtime('{{API_KEY}}'); @@ -261,7 +265,7 @@ const channel = realtime.channels.get('{{RANDOM_CHANNEL_NAME}}', channelOpts); As `occupancy` requires a channel subscription, it is only available when using the realtime interface of an Ably SDK. #### Subscribe to occupancy events @@ -459,7 +463,7 @@ The available set of channel mode flags are: | `ANNOTATION_PUBLISH` | Can publish annotations to messages on the channel. | Yes | | `ANNOTATION_SUBSCRIBE` | Can subscribe to individual annotations on the channel. | No | -The set of modes available to a client is determined by the set of [capabilities](/docs/auth/capabilities) granted by their token or API key. +The set of modes available to a client is determined by the set of [capabilities](/docs/platform/auth/capabilities) granted by their token or API key. The modes granted by each capability are: diff --git a/src/pages/docs/channels/options/rewind.mdx b/src/pages/docs/channels/options/rewind.mdx index 91f4326318..23cb91d3df 100644 --- a/src/pages/docs/channels/options/rewind.mdx +++ b/src/pages/docs/channels/options/rewind.mdx @@ -35,6 +35,10 @@ If you have enabled the [persist last message](/docs/storage-history/storage#per The following example subscribes to a channel and retrieves the most recent message sent on it, if available: + + ```realtime_javascript const realtime = new Ably.Realtime('{{API_KEY}}'); diff --git a/src/pages/docs/channels/states.mdx b/src/pages/docs/channels/states.mdx index 32dfca1ff7..e9e216204b 100644 --- a/src/pages/docs/channels/states.mdx +++ b/src/pages/docs/channels/states.mdx @@ -626,7 +626,7 @@ channel.Attach(context.Background()) ### Fatal channel errors -Some classes of errors are fatal. These cause the channel to move to the `FAILED` state. Ably SDKs will not attempt any automatic recovery actions. For example, when attempting to attach to a channel, with a token that doesn't have the `subscribe` [capability](/docs/auth/capabilities) for that channel, will cause that channel to enter the `FAILED` state. +Some classes of errors are fatal. These cause the channel to move to the `FAILED` state. Ably SDKs will not attempt any automatic recovery actions. For example, when attempting to attach to a channel, with a token that doesn't have the `subscribe` [capability](/docs/platform/auth/capabilities) for that channel, will cause that channel to enter the `FAILED` state. Whilst fatal errors won't get better on their own, they are fixable. For example, if a channel goes into the `FAILED` state due to the client not having the right capabilities to attach to it, that client could call [`authorize()`](/docs/api/realtime-sdk/authentication#authorize) to obtain a new token which does have the right capabilities, then call [`attach()`](/docs/api/realtime-sdk/channels#attach) on the channel. The library will not automatically reattach in the `FAILED` state, however explicit calls to [`attach()`](/docs/api/realtime-sdk/channels#attach) will make the client try again. diff --git a/src/pages/docs/chat/authentication.mdx b/src/pages/docs/chat/authentication.mdx new file mode 100644 index 0000000000..1e634ee63c --- /dev/null +++ b/src/pages/docs/chat/authentication.mdx @@ -0,0 +1,114 @@ +--- +title: Chat authentication +meta_description: "Configure authentication for Chat applications with the required capabilities." +--- + +For comprehensive authentication guidance including server implementation, client patterns, and token lifecycle, see [Platform Authentication](/docs/platform/auth/token). + +This page covers Chat-specific capabilities and room scoping. + +## Chat capabilities + +Your tokens need specific capabilities depending on which Chat features you use: + +| Feature | Required Capabilities | +|---------|----------------------| +| Send messages | `publish` | +| Receive messages | `subscribe` | +| Update messages | `message-update-any` or `message-update-own` | +| Delete messages | `message-delete-any` or `message-delete-own` | +| Message history | `subscribe`, `history` | +| Message reactions | `annotation-publish`, optionally `annotation-subscribe` | +| Presence | `subscribe`, `presence` | +| Typing indicators | `publish`, `subscribe` | +| Room reactions | `publish`, `subscribe` | +| Occupancy | `subscribe`, `channel-metadata` | +| **All Chat features** | `publish`, `subscribe`, `presence`, `history`, `channel-metadata`, `annotation-publish`, `annotation-subscribe`, `message-update-own`, `message-delete-own` | + +## Room-scoped capabilities + +You can restrict tokens to specific chat rooms. Chat rooms use a channel naming format of `your-room::$chat`: + + +```javascript +// Server-side JWT with room-scoped capabilities +import jwt from 'jsonwebtoken'; + +const [keyName, keySecret] = process.env.ABLY_API_KEY.split(':'); + +const ablyJwt = jwt.sign( + { + 'x-ably-capability': JSON.stringify({ + // Only allow access to a specific room + 'your-room::$chat': ['publish', 'subscribe', 'presence', 'history'], + }), + 'x-ably-clientId': userId, + }, + keySecret, + { algorithm: 'HS256', keyid: keyName, expiresIn: '1h' } +); +``` + +```python +# Server-side JWT with room-scoped capabilities +import jwt +import json +import time +import os + +key_name, key_secret = os.environ['ABLY_API_KEY'].split(':') + +now = int(time.time()) +ably_jwt = jwt.encode( + { + 'iat': now, + 'exp': now + 3600, + 'x-ably-capability': json.dumps({ + # Only allow access to a specific room + 'your-room::$chat': ['publish', 'subscribe', 'presence', 'history'], + }), + 'x-ably-clientId': user_id, + }, + key_secret, + algorithm='HS256', + headers={'kid': key_name} +) +``` + + + + +## Client setup + +Use `authCallback` to fetch JWTs from your auth server: + + +```javascript +import * as Ably from 'ably'; +import { ChatClient } from '@ably/chat'; + +const realtimeClient = new Ably.Realtime({ + authCallback: async (tokenParams, callback) => { + try { + const response = await fetch('/api/ably-token'); + const jwt = await response.text(); + callback(null, jwt); + } catch (error) { + callback(error, null); + } + }, +}); + +const chatClient = new ChatClient(realtimeClient); +``` + + +See [token authentication](/docs/platform/auth/token#auth-callback) for complete examples in all languages. + +## Further reading + +- [Token authentication](/docs/platform/auth/token) - Complete token authentication guide +- [Capabilities](/docs/platform/auth/capabilities) - Fine-grained permission control +- [Identified clients](/docs/platform/auth/identified-clients) - Assigning trusted client identities diff --git a/src/pages/docs/chat/getting-started/android.mdx b/src/pages/docs/chat/getting-started/android.mdx index f29424da58..bb5ebb1e8b 100644 --- a/src/pages/docs/chat/getting-started/android.mdx +++ b/src/pages/docs/chat/getting-started/android.mdx @@ -68,7 +68,11 @@ ably login Replace the contents of your `MainActivity.kt` file with the following code to set up the Ably client. -Note that this is for example purposes only. In production, you should use [token authentication](/docs/auth/token) to avoid exposing your API keys publicly, the [`clientId`](/docs/auth/identified-clients) is used to identify the client: + + +The [`clientId`](/docs/platform/auth/identified-clients) is used to identify the client: ```kotlin @@ -106,9 +110,12 @@ class MainActivity : ComponentActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) + // WARNING: This uses an API key for simplicity. + // In production, use token authentication instead. + // See: https://ably.com/docs/platform/auth/token realtimeClient = AblyRealtime( ClientOptions().apply { - key = "{{API_KEY}}" // In production, you should use token authentication to avoid exposing your API keys publicly + key = "{{API_KEY}}" clientId = "my-first-client" }, ) @@ -968,7 +975,7 @@ class MainActivity : ComponentActivity() { Continue to explore the documentation with Kotlin as the selected language: -* Understand [token authentication](/docs/auth/token) before going to production. +* Understand [JWT token authentication](/docs/platform/auth/token#choosing-jwt) before going to production. * Read more about using [rooms](/docs/chat/rooms?lang=kotlin) and sending [messages](/docs/chat/rooms/messages?lang=kotlin). * Find out more regarding [presence](/docs/chat/rooms/presence?lang=kotlin). * Read into pulling messages from [history](/docs/chat/rooms/history?lang=kotlin) and providing context to new joiners. diff --git a/src/pages/docs/chat/getting-started/javascript.mdx b/src/pages/docs/chat/getting-started/javascript.mdx index 17e0302680..a229492c05 100644 --- a/src/pages/docs/chat/getting-started/javascript.mdx +++ b/src/pages/docs/chat/getting-started/javascript.mdx @@ -84,7 +84,11 @@ ably login Clients establish a connection with Ably when they instantiate an SDK. This enables them to send and receive messages in realtime across channels. -Create an `index.ts` file in your project and add the following function to instantiate a realtime client with the Pub/Sub SDK and then pass that client into the Chat SDK constructor. Provide an API key and a [`clientId`](/docs/auth/identified-clients) to identify the client. In production, use [token authentication](/docs/auth/token) so that your API keys are not exposed publicly. +Create an `index.ts` file in your project and add the following function to instantiate a realtime client with the Pub/Sub SDK and then pass that client into the Chat SDK constructor. Provide an API key and a [`clientId`](/docs/platform/auth/identified-clients) to identify the client. + + ```javascript @@ -98,6 +102,9 @@ async function getStarted() { throw new Error('ABLY_API_KEY environment variable is required'); } + // Server-side: Using API key is safe here. + // For client-side browser/mobile apps, use token authentication instead. + // See: https://ably.com/docs/platform/auth/token const realtimeClient = new Ably.Realtime({ key: apiKey, clientId: 'my-first-client' }); const chatClient = new ChatClient(realtimeClient); @@ -297,7 +304,7 @@ setTimeout(() => realtimeClient.close(), 10000); Continue to explore the documentation with JavaScript as the selected language: -* Understand [token authentication](/docs/auth/token?lang=javascript) before going to production. +* Understand [JWT token authentication](/docs/platform/auth/token#choosing-jwt) before going to production. * Read more about using [rooms](/docs/chat/rooms?lang=javascript) and sending [messages](/docs/chat/rooms/messages?lang=javascript). * Find out more regarding [presence](/docs/chat/rooms/presence?lang=javascript). * Read into pulling messages from [history](/docs/chat/rooms/history?lang=javascript) and providing context to new joiners. diff --git a/src/pages/docs/chat/getting-started/jvm.mdx b/src/pages/docs/chat/getting-started/jvm.mdx index cfc57bae24..dcf3a36083 100644 --- a/src/pages/docs/chat/getting-started/jvm.mdx +++ b/src/pages/docs/chat/getting-started/jvm.mdx @@ -83,7 +83,11 @@ Clients establish a connection with Ably when they instantiate an SDK. This enab Add the following code to the `App.kt` file created by `gradle init` set up the Ably client. -Note that this is for example purposes only. In production, you should use [token authentication](/docs/auth/token) to avoid exposing your API keys publicly. The [`clientId`](/docs/auth/identified-clients) is used to identify the client when using an API key: + + +The [`clientId`](/docs/platform/auth/identified-clients) is used to identify the client: ```kotlin @@ -104,9 +108,11 @@ suspend fun main() { } suspend fun demonstrateMessages() { + // Server-side: Using API key is safe here. + // For Android apps, use token authentication instead. + // See: https://ably.com/docs/platform/auth/token val realtimeClient = AblyRealtime( ClientOptions().apply { - // In production, you should use token authentication to avoid exposing your API keys publicly key = ABLY_KEY clientId = "my-first-client" } @@ -617,7 +623,7 @@ This demonstrates proper resource management and graceful shutdown of the chat c Continue to explore the documentation with Kotlin as the selected language: -* Understand [token authentication](/docs/auth/token) before going to production. +* Understand [JWT token authentication](/docs/platform/auth/token#choosing-jwt) before going to production. * Read more about using [rooms](/docs/chat/rooms?lang=kotlin) and sending [messages](/docs/chat/rooms/messages?lang=kotlin). * Find out more regarding [presence](/docs/chat/rooms/presence?lang=kotlin). * Read into pulling messages from [history](/docs/chat/rooms/history?lang=kotlin) and providing context to new joiners. diff --git a/src/pages/docs/chat/getting-started/react-native.mdx b/src/pages/docs/chat/getting-started/react-native.mdx index f51daa7034..46ffbca6cc 100644 --- a/src/pages/docs/chat/getting-started/react-native.mdx +++ b/src/pages/docs/chat/getting-started/react-native.mdx @@ -75,7 +75,11 @@ ably login The Ably Pub/Sub SDK and the Ably Chat SDK expose React hooks and context providers to make it easier to use them in your React Native components. The [`AblyProvider`](/docs/getting-started/react-hooks#ably-provider) and [`ChatClientProvider`](https://sdk.ably.com/builds/ably/ably-chat-js/main/typedoc/functions/chat-react.ChatClientProvider.html) should be used at the top level of your application, typically in `App.tsx`. These are required when working with the [`useChatConnection`](https://sdk.ably.com/builds/ably/ably-chat-js/main/typedoc/functions/chat-react.useChatConnection.html) hook and [`ChatRoomProvider`](https://sdk.ably.com/builds/ably/ably-chat-js/main/typedoc/functions/chat-react.ChatRoomProvider.html) exposed by Ably Chat. -In production, you should use [token authentication](/docs/auth/token) to avoid exposing your API keys publicly, the [`clientId`](/docs/auth/identified-clients) is used to identify the client. +The [`clientId`](/docs/platform/auth/identified-clients) is used to identify the client. + + Replace the contents of your `App.tsx` file with the following code to set up the providers: @@ -89,7 +93,9 @@ import { ChatClientProvider } from '@ably/chat/react'; import { AblyProvider } from 'ably/react'; import './global.css'; -// Create your Ably Realtime client and ChatClient instances: +// WARNING: This uses an API key for simplicity. +// In production, use token authentication instead. +// See: https://ably.com/docs/platform/auth/token const realtimeClient = new Ably.Realtime({ key: {{API_KEY}}, clientId: 'my-first-client', @@ -938,7 +944,7 @@ const handleDisconnect = () => { Continue to explore the documentation with React Native as the selected language: -* Understand [token authentication](/docs/auth/token) before going to production. +* Understand [JWT token authentication](/docs/platform/auth/token#choosing-jwt) before going to production. * Read more about using [rooms](/docs/chat/rooms?lang=react) and sending [messages](/docs/chat/rooms/messages?lang=react). * Find out more regarding [presence](/docs/chat/rooms/presence?lang=react). * Read into pulling messages from [history](/docs/chat/rooms/history?lang=react) and providing context to new joiners. diff --git a/src/pages/docs/chat/getting-started/react-ui-kit.mdx b/src/pages/docs/chat/getting-started/react-ui-kit.mdx index cea08e6ee1..8eb825894d 100644 --- a/src/pages/docs/chat/getting-started/react-ui-kit.mdx +++ b/src/pages/docs/chat/getting-started/react-ui-kit.mdx @@ -107,6 +107,10 @@ ably-chat-react-ui-kit relies on the same React context providers as the underly In your main entry file (e.g. `main.tsx`), replace the content with the following code to set up the providers: + + ```react // main.tsx @@ -116,7 +120,9 @@ In your main entry file (e.g. `main.tsx`), replace the content with the followin import { ThemeProvider, AvatarProvider, ChatSettingsProvider } from '@ably/chat-react-ui-kit'; import '@ably/chat-react-ui-kit/dist/style.css'; - // Create Ably Realtime client + // WARNING: This uses an API key for simplicity. + // In production, use token authentication instead. + // See: https://ably.com/docs/platform/auth/token const ablyClient = new Ably.Realtime({ key: process.env.ABLY_API_KEY, clientId: 'your-chat-client-id', @@ -140,9 +146,7 @@ In your main entry file (e.g. `main.tsx`), replace the content with the followin ``` -The components you make throughout this guide will be wrapped in these providers to ensure they have access to the necessary context. - -In production, you should use [token authentication](/docs/auth/token) to avoid exposing your API keys publicly, the [`clientId`](/docs/auth/identified-clients) is used to identify the client. +The components you make throughout this guide will be wrapped in these providers to ensure they have access to the necessary context. The [`clientId`](/docs/platform/auth/identified-clients) is used to identify the client. ### Provider responsibilities @@ -555,7 +559,7 @@ The UI Kit is experimental and highly likely to change in future releases. Continue to explore the documentation with React as the selected language: -* Understand [token authentication](/docs/auth/token) before going to production. +* Understand [JWT token authentication](/docs/platform/auth/token#choosing-jwt) before going to production. * Read more about using [rooms](/docs/chat/rooms?lang=react) and sending [messages](/docs/chat/rooms/messages?lang=react). * Find out more regarding [presence](/docs/chat/rooms/presence?lang=react). * Read into pulling messages from [history](/docs/chat/rooms/history?lang=react) and providing context to new joiners. diff --git a/src/pages/docs/chat/getting-started/react.mdx b/src/pages/docs/chat/getting-started/react.mdx index 1be877d3b6..aca191935a 100644 --- a/src/pages/docs/chat/getting-started/react.mdx +++ b/src/pages/docs/chat/getting-started/react.mdx @@ -108,7 +108,11 @@ import { The Ably Pub/Sub SDK and the Ably Chat SDK expose React hooks and context providers to make it easier to use them in your React components. The [`AblyProvider`](/docs/getting-started/react-hooks#ably-provider) and [`ChatClientProvider`](https://sdk.ably.com/builds/ably/ably-chat-js/main/typedoc/functions/chat-react.ChatClientProvider.html) should be used at the top level of your application, typically in `main.tsx`. These are required when working with the [`useChatConnection`](https://sdk.ably.com/builds/ably/ably-chat-js/main/typedoc/functions/chat-react.useChatConnection.html) hook and [`ChatRoomProvider`](https://sdk.ably.com/builds/ably/ably-chat-js/main/typedoc/functions/chat-react.ChatRoomProvider.html) exposed by Ably Chat. -In production, you should use [token authentication](/docs/auth/token) to avoid exposing your API keys publicly, the [`clientId`](/docs/auth/identified-clients) is used to identify the client. +The [`clientId`](/docs/platform/auth/identified-clients) is used to identify the client. + + Replace the contents of your `src/main.tsx` file with the following code to set up the providers: @@ -123,7 +127,9 @@ import { ChatClientProvider } from '@ably/chat/react'; import { AblyProvider } from 'ably/react'; import App from './App'; // Your main app component -// Create your Ably Realtime client and ChatClient instances: +// WARNING: This uses an API key for simplicity. +// In production, use token authentication instead. +// See: https://ably.com/docs/platform/auth/token const realtimeClient = new Ably.Realtime({ key: import.meta.env.VITE_ABLY_API_KEY, clientId: 'my-first-client', @@ -935,7 +941,7 @@ This will close the connection to Ably and clean up any associated resources. Continue to explore the documentation with React as the selected language: -* Understand [token authentication](/docs/auth/token) before going to production. +* Understand [JWT token authentication](/docs/platform/auth/token#choosing-jwt) before going to production. * Read more about using [rooms](/docs/chat/rooms?lang=react) and sending [messages](/docs/chat/rooms/messages?lang=react). * Find out more regarding [presence](/docs/chat/rooms/presence?lang=react). * Read into pulling messages from [history](/docs/chat/rooms/history?lang=react) and providing context to new joiners. diff --git a/src/pages/docs/chat/getting-started/swift.mdx b/src/pages/docs/chat/getting-started/swift.mdx index 1725519f8e..8c6b993be0 100644 --- a/src/pages/docs/chat/getting-started/swift.mdx +++ b/src/pages/docs/chat/getting-started/swift.mdx @@ -60,9 +60,13 @@ Create a new iOS project with SwiftUI. For detailed instructions, refer to the [ ## Step 1: Setting up Ably -Replace the contents of your `ContentView.swift` file with the following code to set up the Ably client, this is using a demo API key, if you wish to use this application with the CLI, change the API key with your own key: +Replace the contents of your `ContentView.swift` file with the following code to set up the Ably client. -Note that this is for example purposes only. In production, you should use [token authentication](/docs/auth/token) to avoid exposing your API keys publicly, the [`clientId`](/docs/auth/identified-clients) is used to identify the client: + + +The [`clientId`](/docs/platform/auth/identified-clients) is used to identify the client: ```swift @@ -77,8 +81,11 @@ struct ContentView: View { @State private var chatClient: ChatClient init() { + // WARNING: This uses an API key for simplicity. + // In production, use token authentication instead. + // See: https://ably.com/docs/platform/auth/token let realtimeOptions = ARTClientOptions() - realtimeOptions.key = "{{API_KEY}}" // In production, use token authentication + realtimeOptions.key = "{{API_KEY}}" realtimeOptions.clientId = "my-first-client" let realtime = ARTRealtime(options: realtimeOptions) @@ -1273,7 +1280,7 @@ var body: some View { Continue to explore the documentation with Swift as the selected language: -* Understand [token authentication](/docs/auth/token) before going to production. +* Understand [JWT token authentication](/docs/platform/auth/token#choosing-jwt) before going to production. * Read more about using [rooms](/docs/chat/rooms?lang=swift) and sending [messages](/docs/chat/rooms/messages?lang=swift). * Find out more regarding [presence](/docs/chat/rooms/presence?lang=swift). * Read into pulling messages from [history](/docs/chat/rooms/history?lang=swift) and providing context to new joiners. diff --git a/src/pages/docs/chat/index.mdx b/src/pages/docs/chat/index.mdx index c4b96234fa..3f1bcf1d63 100644 --- a/src/pages/docs/chat/index.mdx +++ b/src/pages/docs/chat/index.mdx @@ -81,4 +81,4 @@ Take a look at a [livestream basketball game](https://ably-livestream-chat-demo. * Read more about using [rooms](/docs/chat/rooms) and sending [messages](/docs/chat/rooms/messages). * Read into pulling messages from [history](/docs/chat/rooms/history) and providing context to new joiners. * Learn about how to add [chat moderation](/docs/chat/moderation). -* Understand [token authentication](/docs/auth/token) before going to production. +* Understand [token authentication](/docs/platform/auth/token) before going to production. diff --git a/src/pages/docs/chat/react-ui-kit/components.mdx b/src/pages/docs/chat/react-ui-kit/components.mdx index b4fdce3818..7613cef773 100644 --- a/src/pages/docs/chat/react-ui-kit/components.mdx +++ b/src/pages/docs/chat/react-ui-kit/components.mdx @@ -136,6 +136,10 @@ The `App` component is a complete, ready-to-use chat application that combines a ### Usage + + ```react import { App } from '@ably/chat-react-ui-kit'; diff --git a/src/pages/docs/chat/react-ui-kit/providers.mdx b/src/pages/docs/chat/react-ui-kit/providers.mdx index 87519c7421..01ed91768d 100644 --- a/src/pages/docs/chat/react-ui-kit/providers.mdx +++ b/src/pages/docs/chat/react-ui-kit/providers.mdx @@ -12,6 +12,10 @@ The components in the Ably Chat React UI Kit rely on several React context provi Other providers like the `ChatSettingsProvider`, `ThemeProvider` and `AvatarProvider` can be used to manage themes, avatars, and chat settings respectively. These providers should be placed at the highest level of any component tree that contains Chat UI components. + + ```react import * as Ably from 'ably'; diff --git a/src/pages/docs/chat/react-ui-kit/setup.mdx b/src/pages/docs/chat/react-ui-kit/setup.mdx index 8ffc7cfe97..95d79fbb17 100644 --- a/src/pages/docs/chat/react-ui-kit/setup.mdx +++ b/src/pages/docs/chat/react-ui-kit/setup.mdx @@ -49,6 +49,10 @@ The React UI Kit relies on several context providers to function properly. These Set up the required providers in your application's entry point: + + ```react import * as Ably from 'ably'; diff --git a/src/pages/docs/chat/rooms/index.mdx b/src/pages/docs/chat/rooms/index.mdx index 4e8a3bdfc0..8e61b45fbd 100644 --- a/src/pages/docs/chat/rooms/index.mdx +++ b/src/pages/docs/chat/rooms/index.mdx @@ -36,6 +36,10 @@ All components that utilize chat feature hooks must be children of a `ChatRoomPr + + ```javascript const room = await chatClient.rooms.get('basketball-stream', {occupancy: {enableEvents: true}}); diff --git a/src/pages/docs/chat/setup.mdx b/src/pages/docs/chat/setup.mdx index fdb0aafdaf..366eca79a3 100644 --- a/src/pages/docs/chat/setup.mdx +++ b/src/pages/docs/chat/setup.mdx @@ -11,19 +11,23 @@ If you have any feedback or feature requests, [let us know](https://forms.gle/Sm ## Authentication -An API key is required to authenticate with Ably. API keys are used either to authenticate directly with Ably using basic authentication, or to generate tokens for untrusted clients using [token authentication](/docs/auth/token). - -[Sign up](https://ably.com/sign-up) to Ably to create an API key in the dashboard or use the [Control API](/docs/platform/account/control-api) to create an API key programmatically. +Chat requires an authenticated client with a `clientId` to identify users. The recommended approach is: + +1. **Client-side apps** (browsers, iOS, Android): Use [JWT authentication](/docs/platform/auth/token#choosing-jwt) with `authCallback` to fetch JWTs from your server +2. **Server-side apps** (Node.js, Python, etc.): Use your API key directly -API keys and tokens have a set of [capabilities](/docs/auth/capabilities) assigned to them that specify which operations, such as subscribe or publish can be performed on which resources. To use the Chat SDK, the API key requires the following capabilities depending on which features are being used: +[Sign up](https://ably.com/sign-up) to Ably to create an API key in the [dashboard](https://ably.com/dashboard) or use the [Control API](/docs/platform/account/control-api) to create an API key programmatically. Your server will use this key to issue tokens to clients. + +API keys and tokens have a set of [capabilities](/docs/platform/auth/capabilities) assigned to them that specify which operations, such as subscribe or publish can be performed on which resources. To use the Chat SDK, the API key requires the following capabilities depending on which features are being used: | Feature | Capabilities | | ------- | ------------ | -| Send and receive messages | `publish`, `subscribe` | +| Send messages | `publish` | +| Receive messages | `subscribe` | | Update message | `message-update-any` or `message-update-own` | | Delete message | `message-delete-any` or `message-delete-own` | | Message history | `subscribe`, `history` | @@ -39,7 +43,7 @@ When setting the capabilities for Chat, you can apply them to specific chat room * `dms:*` or * `*` -For more guidance, see the [capabilities documentation](/docs/auth/capabilities). +For more guidance, see the [capabilities documentation](/docs/platform/auth/capabilities). ## Install @@ -82,7 +86,18 @@ Reference the Pub/Sub SDK and the Chat SDK within your HTML file: ``` @@ -143,18 +158,44 @@ Instantiate a realtime client using the Pub/Sub SDK and pass the generated clien Pass the `ChatClient` into the [`ChatClientProvider`](https://sdk.ably.com/builds/ably/ably-chat-js/main/typedoc/functions/chat-react.ChatClientProvider.html). The `ChatClient` instance will be available to all child components in your React component tree. +### Client-side authentication (recommended) + +Use token authentication for browsers and mobile apps. Your auth server endpoint validates the user and returns an Ably token with the appropriate `clientId`: + ```javascript +// Client-side: Token authentication (recommended for browsers) import { LogLevel } from '@ably/chat' -const realtimeClient = new Ably.Realtime({ key: '{{API_KEY}}', clientId: ''}); +const realtimeClient = new Ably.Realtime({ + authCallback: async (tokenParams, callback) => { + try { + const response = await fetch('/api/ably-token'); + const token = await response.text(); + callback(null, token); + } catch (error) { + callback(error, null); + } + }, +}); const chatClient = new ChatClient(realtimeClient, { logLevel: LogLevel.Error }); ``` ```react +// Client-side: Token authentication (recommended for React apps) import { LogLevel } from '@ably/chat' -const realtimeClient = new Ably.Realtime({ key: '{{API_KEY}}', clientId: ''}); +const realtimeClient = new Ably.Realtime({ + authCallback: async (tokenParams, callback) => { + try { + const response = await fetch('/api/ably-token'); + const token = await response.text(); + callback(null, token); + } catch (error) { + callback(error, null); + } + }, +}); const chatClient = new ChatClient(realtimeClient, { logLevel: LogLevel.Error }); const App = () => { @@ -167,22 +208,42 @@ const App = () => { ``` ```swift +// Client-side: Token authentication (recommended for iOS apps) let realtimeOptions = ARTClientOptions() -realtimeOptions.key = "{{API_KEY}}" -realtimeOptions.clientId = "" +realtimeOptions.authCallback = { tokenParams, callback in + // Fetch token from your auth server + fetchAblyToken { result in + switch result { + case .success(let tokenRequest): + callback(tokenRequest, nil) + case .failure(let error): + callback(nil, error) + } + } +} let realtime = ARTRealtime(options: realtimeOptions) let chatClient = ChatClient(realtime: realtime) ``` ```kotlin +// Client-side: Token authentication (recommended for Android apps) import com.ably.chat.ChatClient import io.ably.lib.realtime.AblyRealtime import io.ably.lib.types.ClientOptions val realtimeClient = AblyRealtime( ClientOptions().apply { - key = "{{API_KEY}}" - clientId = "" + authCallback = { tokenParams, callback -> + // Fetch token from your auth server + fetchAblyToken { result -> + result.onSuccess { tokenRequest -> + callback.onSuccess(tokenRequest) + } + result.onFailure { error -> + callback.onError(ErrorInfo(error.message, 40000, 401)) + } + } + } }, ) @@ -190,9 +251,118 @@ val chatClient = ChatClient(realtimeClient) ``` -A [`ClientOptions`](/docs/api/realtime-sdk#client-options) object may be passed to the Pub/Sub SDK instance to further customize the connection, however at a minimum you must set an API key and provide a `clientId` to ensure that the client is [identified](/docs/auth/identified-clients). +Your auth server endpoint (`/api/ably-token`) should authenticate the user and return a token. See the [token authentication](/docs/platform/auth/token) documentation for server implementation examples. + +### Server-side authentication + +For server-side applications or local development, you can use an API key directly: + + +```javascript +// Server-side only: API key authentication +// WARNING: Never use this in client-side code (browsers, mobile apps) +import { LogLevel } from '@ably/chat' + +const realtimeClient = new Ably.Realtime({ + key: process.env.ABLY_API_KEY, + clientId: 'server-process-1', +}); +const chatClient = new ChatClient(realtimeClient, { logLevel: LogLevel.Error }); +``` + + + + +A [`ClientOptions`](/docs/api/realtime-sdk#client-options) object may be passed to the Pub/Sub SDK instance to further customize the connection. When using token authentication, the `clientId` is set by your auth server. When using API key authentication server-side, you must provide a `clientId` to ensure that the client is [identified](/docs/platform/auth/identified-clients). + +### Using Ably JWT (alternative) + +If you have existing JWT-based authentication infrastructure (Auth0, Firebase, Cognito, or custom), you can create Ably JWTs directly without using the Ably SDK on your server: + +**Server (no Ably SDK required):** + + +```javascript +import jwt from 'jsonwebtoken'; + +const [keyName, keySecret] = process.env.ABLY_API_KEY.split(':'); + +app.get('/api/ably-jwt', async (req, res) => { + // Your existing auth middleware validates the user + const userId = req.user.id; + + const ablyJwt = jwt.sign( + { + 'x-ably-capability': JSON.stringify({ + '*': ['publish', 'subscribe', 'presence', 'history'], + }), + 'x-ably-clientId': userId, + }, + keySecret, + { algorithm: 'HS256', keyid: keyName, expiresIn: '1h' } + ); + + res.send(ablyJwt); +}); +``` + + +**Client:** + + +```javascript +const realtimeClient = new Ably.Realtime({ + authCallback: async (tokenParams, callback) => { + try { + const response = await fetch('/api/ably-jwt'); + const jwt = await response.text(); + callback(null, jwt); + } catch (error) { + callback(error, null); + } + }, +}); +const chatClient = new ChatClient(realtimeClient); +``` + +```swift +let realtimeOptions = ARTClientOptions() +realtimeOptions.authCallback = { tokenParams, callback in + fetchAblyJwt { result in + switch result { + case .success(let jwt): + callback(jwt as ARTTokenDetailsCompatible, nil) + case .failure(let error): + callback(nil, error) + } + } +} +let realtime = ARTRealtime(options: realtimeOptions) +let chatClient = ChatClient(realtime: realtime) +``` + +```kotlin +val realtimeClient = AblyRealtime( + ClientOptions().apply { + authCallback = Auth.TokenCallback { _ -> + // Fetch JWT from your server + fetchAblyJwt() + } + } +) +val chatClient = ChatClient(realtimeClient) +``` + + +**Why choose JWT for Chat?** +- No Ably SDK required on your server +- Integrates with existing Auth0/Firebase/Cognito flows +- Supports [channel-scoped claims](/docs/platform/auth/capabilities#custom-restrictions) for user roles in chat rooms +- Eliminates client round-trip to Ably -In many cases, a users unique application-specific identifier may be used as the `clientId` to provide consistent identification for clients across your application. +See [Choosing a token mechanism](/docs/platform/auth/token#choosing) for detailed guidance on when to use JWT vs TokenRequest. Additional options can also be passed to the Chat client to customize the following properties: @@ -229,7 +399,13 @@ Set the `logHandler` and `logLevel` properties when [instantiating a client](#in ```javascript -const ably = new Ably.Realtime({ key: '{{API_KEY}}', clientId: ''}); +// Using token authentication (recommended for client-side) +const ably = new Ably.Realtime({ + authCallback: async (tokenParams, callback) => { + const response = await fetch('/api/ably-token'); + callback(null, await response.text()); + }, +}); const chatClient = new ChatClient(ably, {logHandler: logWriteFunc, logLevel: 'debug' }); ``` @@ -238,10 +414,16 @@ import * as Ably from 'ably'; import { LogLevel } from '@ably/chat'; import { ChatClientProvider } from '@ably/chat/react'; -const ably = new Ably.Realtime({ key: '{{API_KEY}}', clientId: ''}); +// Using token authentication (recommended for React apps) +const ably = new Ably.Realtime({ + authCallback: async (tokenParams, callback) => { + const response = await fetch('/api/ably-token'); + callback(null, await response.text()); + }, +}); const chatClient = new ChatClient(ably, {logHandler: logWriteFunc, logLevel: 'debug' }); -const App = => { +const App = () => { return ( @@ -252,18 +434,30 @@ const App = => { ```swift let realtimeOptions = ARTClientOptions() -realtimeOptions.key = "{{API_KEY}}" -realtimeOptions.clientId = "" +// Using token authentication (recommended for iOS apps) +realtimeOptions.authCallback = { tokenParams, callback in + fetchAblyToken { result in + switch result { + case .success(let tokenRequest): callback(tokenRequest, nil) + case .failure(let error): callback(nil, error) + } + } +} let realtime = ARTRealtime(options: realtimeOptions) let clientOptions = ChatClientOptions(logHandler: SomeLogHandler(), logLevel: .debug) return ChatClient(realtime: realtime, clientOptions: clientOptions) ``` ```kotlin +// Using token authentication (recommended for Android apps) val realtimeClient = AblyRealtime( ClientOptions().apply { - key = "{{API_KEY}}" - clientId = "" + authCallback = { tokenParams, callback -> + fetchAblyToken { result -> + result.onSuccess { callback.onSuccess(it) } + result.onFailure { callback.onError(ErrorInfo(it.message, 40000, 401)) } + } + } }, ) val chatClient = ChatClient(realtimeClient) { diff --git a/src/pages/docs/connect/index.mdx b/src/pages/docs/connect/index.mdx index 5e677d29ad..28ab5de5f0 100644 --- a/src/pages/docs/connect/index.mdx +++ b/src/pages/docs/connect/index.mdx @@ -10,6 +10,10 @@ redirect_from: Clients establish and maintain a connection to the Ably service using the most efficient transport available, typically [WebSockets](https://ably.com/topic/websockets). + + ## Connection multiplexing Ably SDKs operate and multiplex all [channel](/docs/channels) traffic over a single connection. This means you can publish and subscribe to messages on any number of channels simultaneously using just one transport connection. This approach: @@ -32,6 +36,10 @@ Ably SDKs open and maintain a connection to the Ably realtime servers on instant This example relies on the default auto-connect behavior of the SDK, checking for when the connection state is `connected` event: + + ```realtime_javascript // Using callbacks @@ -137,7 +145,7 @@ Explicitly calling connect is unnecessary unless the ClientOptions attribute aut Connection monitoring allows you to view and manage the [states of connections](/docs/connect/states) to Ably, showing events for individual people connecting and disconnecting. The developer console in your Ably account also shows these events. -This feature is intended for debugging, so once the number of new connections exceeds the number of messages per second permitted by the lifecycle channel, new events will be dropped. This means if you want a definitive list of everyone using your app you'd be best using [token authentication](/docs/auth/token) to create your own 'auth server'. +This feature is intended for debugging, so once the number of new connections exceeds the number of messages per second permitted by the lifecycle channel, new events will be dropped. This means if you want a definitive list of everyone using your app you'd be best using [token authentication](/docs/platform/auth/token) to create your own 'auth server'. The Ably dashboard contains a developer console. In the developer console you can view connection events. diff --git a/src/pages/docs/connect/states.mdx b/src/pages/docs/connect/states.mdx index 60f98e8638..7d9c78e2f2 100644 --- a/src/pages/docs/connect/states.mdx +++ b/src/pages/docs/connect/states.mdx @@ -58,7 +58,7 @@ After a period of being offline a connection is re-established: The `Connection` object is an `EventEmitter` and emits an event whose name is the new state whenever there is a connection state change. An event listener function is passed a [ConnectionStateChange](/docs/api/realtime-sdk/connection#connection-state-change) object as the first argument for state change events. -The `Connection` object can also emit an event that is not a state change: an `update` event. This happens when there's a change to connection conditions and there is no applicable status or the state doesn't change, such as when an SDK remains connected after a [reauth](/docs/auth). +The `Connection` object can also emit an event that is not a state change: an `update` event. This happens when there's a change to connection conditions and there is no applicable status or the state doesn't change, such as when an SDK remains connected after a [reauth](/docs/platform/auth). ```realtime_javascript diff --git a/src/pages/docs/faq/index.mdx b/src/pages/docs/faq/index.mdx index b4a2057d32..27d26255b0 100644 --- a/src/pages/docs/faq/index.mdx +++ b/src/pages/docs/faq/index.mdx @@ -127,9 +127,9 @@ Available timeout options: ### Can I change my connection's clientId after connecting? -A connection's [`clientId`](/docs/auth/identified-clients) is immutable once set. +A connection's [`clientId`](/docs/platform/auth/identified-clients) is immutable once set. -However, late initialization of `clientId` is possible. For instance, if the library is instantiated with an [`authCallback`](/docs/auth/token#auth-callback), the `clientId` may only be known after the callback completes. Similarly, if the library uses an opaque token string, it learns the `clientId` only after the server processes the token. In both cases, the "immutable" requirement is satisfied because the `clientId` is set during the client's first interaction with the server. +However, late initialization of `clientId` is possible. For instance, if the library is instantiated with an [`authCallback`](/docs/platform/auth/token#auth-callback), the `clientId` may only be known after the callback completes. Similarly, if the library uses an opaque token string, it learns the `clientId` only after the server processes the token. In both cases, the "immutable" requirement is satisfied because the `clientId` is set during the client's first interaction with the server. ## Connection and network issues diff --git a/src/pages/docs/faq/push-faqs.mdx b/src/pages/docs/faq/push-faqs.mdx index 2485ef1f46..938db7c0d1 100644 --- a/src/pages/docs/faq/push-faqs.mdx +++ b/src/pages/docs/faq/push-faqs.mdx @@ -69,7 +69,7 @@ Follow these steps to check if your device is correctly registered with Ably: | Step | Description | Action/State | |------|-------------|--------------| -| Check registration | Go to Ably dashboard > Notifications > Device inspector. Search using `deviceId` or [`clientId`](/docs/auth/identified-clients). | - | +| Check registration | Go to Ably dashboard > Notifications > Device inspector. Search using `deviceId` or [`clientId`](/docs/platform/auth/identified-clients). | - | | Device states | Registered and should receive notifications. Test using the push inspector in the Notifications tab or test using the `REST` `API` to publish directly to the `deviceId`. | **ACTIVE** | | Device states | Indicates an error "registration expired" if the app was uninstalled. | **FAILED** | | No registration Found | Enable verbose logs and retry the push registration process to view Ably push `API` requests. | - | @@ -104,15 +104,15 @@ If there are no errors, the notification was successfully sent to the push provi ### Why are my push notifications duplicated? -Consistent duplication on a specific device usually indicates both a `deviceId` and a [`clientId`](/docs/auth/identified-clients) subscription to the push [channel](/docs/channels). Remove one to prevent duplication. +Consistent duplication on a specific device usually indicates both a `deviceId` and a [`clientId`](/docs/platform/auth/identified-clients) subscription to the push [channel](/docs/channels). Remove one to prevent duplication. - DeviceId subscriptions: Deliver to a single device. -- [ClientId subscriptions](/docs/auth/identified-clients): Deliver to all devices identified by that `clientId`. +- [ClientId subscriptions](/docs/platform/auth/identified-clients): Deliver to all devices identified by that `clientId`. ### Why can I not publish push notifications on channels? If you're unable to [publish](/docs/channels#publish) push notifications to [channels](/docs/channels), this is typically due to configuration or permission issues. The following are possible reasons for this issue: 1. [Channel Rules](/docs/general/channel-rules): Channels must be explicitly enabled for push notifications via channel rules. They are disabled by default. -2. [Permissions](/docs/auth/capabilities): The publisher must have permission to publish to that channel. +2. [Permissions](/docs/platform/auth/capabilities): The publisher must have permission to publish to that channel. 3. Invalid Payload: If the push notification payload in the `extras` field is invalid, the message may be rejected immediately. diff --git a/src/pages/docs/getting-started/dotnet.mdx b/src/pages/docs/getting-started/dotnet.mdx index c235dd4ec1..afa5a2677a 100644 --- a/src/pages/docs/getting-started/dotnet.mdx +++ b/src/pages/docs/getting-started/dotnet.mdx @@ -14,7 +14,7 @@ You'll establish a realtime connection to Ably and learn to publish and subscrib 1. [Sign up](https://ably.com/sign-up) for an Ably account. 2. Create a [new app](https://ably.com/accounts/any/apps/new), and create your first API key in the **API Keys** tab of the dashboard. -3. Your API key will need the `publish`, `subscribe`, `presence` and `history` [capabilities](/docs/auth/capabilities). +3. Your API key will need the `publish`, `subscribe`, `presence` and `history` [capabilities](/docs/platform/auth/capabilities). 4. Install [.NET SDK](https://dotnet.microsoft.com/download) (version 6.0 or later). 5. Create a new C# console application: @@ -65,7 +65,11 @@ Clients establish a connection with Ably when they instantiate an SDK instance. Open up the [dev console](https://ably.com/accounts/any/apps/any/console) of your first app before instantiating your client so that you can see what happens. -Replace the contents of your `Program.cs` file with functionality to instantiate the SDK and establish a connection to Ably. At the minimum you need to provide an authentication mechanism. Use an API key for simplicity, but you should use [token authentication](/docs/auth/token) in production environments. A [`clientId`](/docs/auth/identified-clients) ensures the client is identified, which is required to use certain features, such as presence: +Replace the contents of your `Program.cs` file with functionality to instantiate the SDK and establish a connection to Ably. At the minimum you need to provide an authentication mechanism. A [`clientId`](/docs/platform/auth/identified-clients) ensures the client is identified, which is required to use certain features, such as presence. + + ```csharp @@ -77,7 +81,9 @@ class Program { static async Task Main(string[] args) { - // Initialize the Ably Realtime client + // Server-side: Using API key is safe here. + // For client-side apps, use token authentication instead. + // See: https://ably.com/docs/platform/auth/token var clientOptions = new ClientOptions("{{API_KEY}}") { ClientId = "my-first-client" @@ -232,7 +238,7 @@ The output will look similar to the following: Continue to explore the documentation with C# .NET as the selected language: -* Understand [token authentication](/docs/auth/token) before going to production. +* Understand [JWT token authentication](/docs/platform/auth/token#choosing-jwt) before going to production. * Understand how to effectively [manage connections](https://ably.com/docs/connect#close?lang=csharp). * Explore more [advanced](/docs/pub-sub/advanced?lang=csharp) Pub/Sub concepts. diff --git a/src/pages/docs/getting-started/flutter.mdx b/src/pages/docs/getting-started/flutter.mdx index c3c4a5ccf3..4bf5ec5e75 100644 --- a/src/pages/docs/getting-started/flutter.mdx +++ b/src/pages/docs/getting-started/flutter.mdx @@ -16,7 +16,7 @@ You'll establish a realtime connection to Ably and learn to publish and subscrib 1. [Sign up](https://ably.com/sign-up) for a free Ably account. 2. Create a [new app](https://ably.com/accounts/any/apps/new), and create your first API key in the **API Keys** tab of the dashboard. -3. Your API key will need the `publish`, `subscribe`, `presence` and `history` [capabilities](/docs/auth/capabilities). +3. Your API key will need the `publish`, `subscribe`, `presence` and `history` [capabilities](/docs/platform/auth/capabilities). ### Create a Flutter project @@ -54,6 +54,10 @@ flutter pub get Create a new file `lib/ably_service.dart` to manage your Ably connection: + + ```flutter // lib/ably_service.dart @@ -70,6 +74,9 @@ class AblyService { AblyService._internal(); Future init() async { + // WARNING: This uses an API key for simplicity. + // In production, use token authentication instead. + // See: https://ably.com/docs/platform/auth/token final clientOptions = ably.ClientOptions( key: '{{API_KEY}}', clientId: 'my-first-client', @@ -189,7 +196,11 @@ ably login Clients establish a connection with Ably when they instantiate an SDK instance. This enables them to send and receive messages in realtime across channels. -In the [Set up Ably Realtime Client](#prerequisites-setup-ably-client) section, you added code to create an Ably Realtime client. This code creates a new Realtime client instance, establishing a connection to Ably when your application starts. At the minimum you need to provide an authentication mechanism. While using an API key is fine for the purposes of this guide, you should use [token authentication](/docs/auth/token) in production environments. A [`clientId`](/docs/auth/identified-clients) ensures the client is identified, which is required to use certain features, such as presence. +In the [Set up Ably Realtime Client](#prerequisites-setup-ably-client) section, you added code to create an Ably Realtime client. This code creates a new Realtime client instance, establishing a connection to Ably when your application starts. At the minimum you need to provide an authentication mechanism. A [`clientId`](/docs/platform/auth/identified-clients) ensures the client is identified, which is required to use certain features, such as presence. + + To monitor the Ably connection state within your application, create a widget that displays the current connection state. Create a new file `lib/widgets/connection_state.dart`: @@ -728,7 +739,7 @@ Message number 5 Continue to explore the documentation with Flutter as the selected language: -* Understand [token authentication](/docs/auth/token) before going to production. +* Understand [JWT token authentication](/docs/platform/auth/token#choosing-jwt) before going to production. * Understand how to effectively [manage connections](https://ably.com/docs/connect#close?lang=flutter). * Explore more [advanced](/docs/pub-sub/advanced?lang=flutter) Pub/Sub concepts. diff --git a/src/pages/docs/getting-started/go.mdx b/src/pages/docs/getting-started/go.mdx index 092eeb208d..57e9406ed4 100644 --- a/src/pages/docs/getting-started/go.mdx +++ b/src/pages/docs/getting-started/go.mdx @@ -56,7 +56,11 @@ ably login Clients establish a connection with Ably when they instantiate an SDK instance. This enables them to send and receive messages in realtime across channels. -Create a `main.go` file in your project and add the following function to instantiate the SDK and establish a connection to Ably. At the minimum you need to provide an authentication mechanism. Use an API key for simplicity, but you should use [token authentication](/docs/auth/token) in production environments. A [`clientId`](/docs/auth/identified-clients) ensures the client is identified, which is required to use certain features, such as presence: +Create a `main.go` file in your project and add the following function to instantiate the SDK and establish a connection to Ably. At the minimum you need to provide an authentication mechanism. A [`clientId`](/docs/platform/auth/identified-clients) ensures the client is identified, which is required to use certain features, such as presence. + + ```go @@ -71,6 +75,9 @@ import ( ) func main() { + // Server-side: Using API key is safe here. + // For client-side apps, use token authentication instead. + // See: https://ably.com/docs/platform/auth/token client, err := ably.NewRealtime( ably.WithKey("{{API_KEY}}"), ably.WithClientID("my-first-client"), @@ -243,7 +250,7 @@ The output will look similar to the following: Continue to explore the documentation with Go as the selected language: -* Understand [token authentication](/docs/auth/token) before going to production. +* Understand [JWT token authentication](/docs/platform/auth/token#choosing-jwt) before going to production. * Understand how to effectively [manage connections](https://ably.com/docs/connect#close?lang=go). * Explore more [advanced](/docs/pub-sub/advanced?lang=go) Pub/Sub concepts. diff --git a/src/pages/docs/getting-started/java.mdx b/src/pages/docs/getting-started/java.mdx index c5cc497dff..186c433090 100644 --- a/src/pages/docs/getting-started/java.mdx +++ b/src/pages/docs/getting-started/java.mdx @@ -14,7 +14,7 @@ You'll establish a realtime connection to Ably and learn to publish and subscrib 1. [Sign up](https://ably.com/sign-up) for an Ably account. 2. Create a [new app](https://ably.com/accounts/any/apps/new), and create your first API key in the **API Keys** tab of the dashboard. -3. Your API key will need the `publish`, `subscribe`, `presence` and `history` [capabilities](/docs/auth/capabilities). +3. Your API key will need the `publish`, `subscribe`, `presence` and `history` [capabilities](/docs/platform/auth/capabilities). 4. Install [Java Development Kit (JDK)](https://adoptium.net/) version 8 or greater. 5. Create a new project and add the Ably [Pub/Sub Java SDK](https://github.com/ably/ably-java) as a dependency. @@ -76,7 +76,11 @@ Clients establish a connection with Ably when they instantiate an SDK instance. Open up the [dev console](https://ably.com/accounts/any/apps/any/console) of your first app before instantiating your client so that you can see what happens. -Replace the contents of your `App.java` file with functionality to instantiate the SDK and establish a connection to Ably. At the minimum you need to provide an authentication mechanism. Use an API key for simplicity, but you should use [token authentication](/docs/auth/token) in production environments. A [`clientId`](/docs/auth/identified-clients) ensures the client is identified, which is required to use certain features, such as presence: +Replace the contents of your `App.java` file with functionality to instantiate the SDK and establish a connection to Ably. At the minimum you need to provide an authentication mechanism. A [`clientId`](/docs/platform/auth/identified-clients) ensures the client is identified, which is required to use certain features, such as presence. + + ```java @@ -94,7 +98,9 @@ import io.ably.lib.types.PaginatedResult; public class App { public static void main(String[] args) { try { - // Initialize the Ably Realtime client + // Server-side: Using API key is safe here. + // For Android apps, use token authentication instead. + // See: https://ably.com/docs/platform/auth/token ClientOptions options = new ClientOptions("{{API_KEY}}"); options.clientId = "my-first-client"; AblyRealtime realtime = new AblyRealtime(options); @@ -239,7 +245,7 @@ The output will look similar to the following: Continue to explore the documentation with Java as the selected language: -* Understand [token authentication](/docs/auth/token) before going to production. +* Understand [JWT token authentication](/docs/platform/auth/token#choosing-jwt) before going to production. * Understand how to effectively [manage connections](https://ably.com/docs/connect#close?lang=java). * Explore more [advanced](/docs/pub-sub/advanced?lang=java) Pub/Sub concepts. diff --git a/src/pages/docs/getting-started/javascript.mdx b/src/pages/docs/getting-started/javascript.mdx index 4cfeab0d33..0d4067e60b 100644 --- a/src/pages/docs/getting-started/javascript.mdx +++ b/src/pages/docs/getting-started/javascript.mdx @@ -50,7 +50,11 @@ Clients establish a connection with Ably when they instantiate an SDK instance. Open up the [dev console](https://ably.com/accounts/any/apps/any/console) of your first app before instantiating your client so that you can see what happens. -Create an `index.html` file in your project and add the following HTML to include the Ably JavaScript SDK via CDN and establish a connection to Ably. At the minimum you need to provide an authentication mechanism. Use an API key for simplicity, but you should use [token authentication](/docs/auth/token#jwt) in a production app. A [`clientId`](/docs/auth/identified-clients) ensures the client is identified, which is required to use certain features, such as presence: +Create an `index.html` file in your project and add the following HTML to include the Ably JavaScript SDK via CDN and establish a connection to Ably. At the minimum you need to provide an authentication mechanism. A [`clientId`](/docs/platform/auth/identified-clients) ensures the client is identified, which is required to use certain features, such as presence. + + ```html @@ -75,6 +79,9 @@ Create an `index.html` file in your project and add the following HTML to includ } async function getStarted() { + // WARNING: This uses an API key for simplicity. + // In production, use token authentication instead. + // See: https://ably.com/docs/platform/auth/token const realtimeClient = new Ably.Realtime({ key: '{{API_KEY}}', clientId: 'my-first-client' @@ -206,7 +213,7 @@ The output will look similar to the following: Continue to explore the documentation with JavaScript as the selected language: -* Understand [token authentication](/docs/auth/token) before going to production. +* Understand [JWT token authentication](/docs/platform/auth/token#choosing-jwt) before going to production. * Understand how to effectively [manage connections](https://ably.com/docs/connect#close?lang=javascript). * Explore more [advanced](/docs/pub-sub/advanced?lang=javascript) Pub/Sub concepts. diff --git a/src/pages/docs/getting-started/kotlin.mdx b/src/pages/docs/getting-started/kotlin.mdx index d9e5df9b0a..551d6b0859 100644 --- a/src/pages/docs/getting-started/kotlin.mdx +++ b/src/pages/docs/getting-started/kotlin.mdx @@ -55,7 +55,11 @@ Clients establish a connection with Ably when they instantiate an SDK. This enab Open up the [dev console](https://ably.com/accounts/any/apps/any/console) of your first app before instantiating your client so that you can see what happens. -Create a `Main.kt` file in your project and add the following function to instantiate the SDK and establish a connection to Ably. At the minimum you need to provide an authentication mechanism. Use an API key for simplicity, but you should use [token authentication](/docs/auth/token) in production environments. A [`clientId`](/docs/auth/identified-clients) ensures the client is identified, which is required to use certain features, such as presence: +Create a `Main.kt` file in your project and add the following function to instantiate the SDK and establish a connection to Ably. At the minimum you need to provide an authentication mechanism. A [`clientId`](/docs/platform/auth/identified-clients) ensures the client is identified, which is required to use certain features, such as presence. + + ```kotlin @@ -64,6 +68,9 @@ import io.ably.lib.realtime.ConnectionEvent import io.ably.lib.types.ClientOptions fun getStarted() { + // WARNING: This uses an API key for simplicity. + // In production, use token authentication instead. + // See: https://ably.com/docs/platform/auth/token val realtimeClient = AblyRealtime(ClientOptions().apply { key = "{{API_KEY}}" clientId = "my-first-client" @@ -184,7 +191,7 @@ The output will look similar to the following: Continue to explore the documentation with Kotlin as the selected language: -* Understand [token authentication](/docs/auth/token) before going to production. +* Understand [JWT token authentication](/docs/platform/auth/token#choosing-jwt) before going to production. * Understand how to effectively [manage connections](https://ably.com/docs/connect#close?lang=kotlin). * Explore more [advanced](/docs/pub-sub/advanced?lang=kotlin) Pub/Sub concepts. diff --git a/src/pages/docs/getting-started/laravel.mdx b/src/pages/docs/getting-started/laravel.mdx index 42667c2ba3..267bbefaf7 100644 --- a/src/pages/docs/getting-started/laravel.mdx +++ b/src/pages/docs/getting-started/laravel.mdx @@ -218,6 +218,10 @@ npm install @ably/laravel-echo ably axios Create or update `resources/js/bootstrap.js` to include Echo configuration: + + ```laravel import axios from 'axios'; @@ -226,6 +230,8 @@ window.axios = axios; window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest'; // Configure Laravel Echo with Ably +// Note: For production, configure proper channel authorization +// See: https://ably.com/docs/platform/auth/token import Echo from '@ably/laravel-echo'; import * as Ably from 'ably'; diff --git a/src/pages/docs/getting-started/node.mdx b/src/pages/docs/getting-started/node.mdx index 3fdcc7b452..87b661109f 100644 --- a/src/pages/docs/getting-started/node.mdx +++ b/src/pages/docs/getting-started/node.mdx @@ -68,13 +68,20 @@ Clients establish a connection with Ably when they instantiate an SDK instance. Open up the [dev console](https://ably.com/accounts/any/apps/any/console) of your first app before instantiating your client so that you can see what happens. -Create an `index.js` file in your project and add the following function to instantiate the SDK and establish a connection to Ably. At the minimum you need to provide an authentication mechanism. Use an API key for simplicity, but you should use [token authentication](/docs/auth/token#jwt) in a production app. A [`clientId`](/docs/auth/identified-clients) ensures the client is identified, which is required to use certain features, such as presence: +Create an `index.js` file in your project and add the following function to instantiate the SDK and establish a connection to Ably. At the minimum you need to provide an authentication mechanism. A [`clientId`](/docs/platform/auth/identified-clients) ensures the client is identified, which is required to use certain features, such as presence. + + ```nodejs import * as Ably from 'ably'; async function getStarted() { + // Server-side: Using API key is safe here. + // For client-side browser apps, use token authentication instead. + // See: https://ably.com/docs/platform/auth/token const realtimeClient = new Ably.Realtime({ key: process.env.ABLY_API_KEY, clientId: 'my-first-client' @@ -199,7 +206,7 @@ The output will look similar to the following: Continue to explore the documentation with JavaScript as the selected language: -* Understand [token authentication](/docs/auth/token) before going to production. +* Understand [JWT token authentication](/docs/platform/auth/token#choosing-jwt) before going to production. * Understand how to effectively [manage connections](https://ably.com/docs/connect#close?lang=nodejs). * Explore more [advanced](/docs/pub-sub/advanced?lang=nodejs) Pub/Sub concepts. diff --git a/src/pages/docs/getting-started/objective-c.mdx b/src/pages/docs/getting-started/objective-c.mdx index d1d3f41d19..1b6076bb4f 100644 --- a/src/pages/docs/getting-started/objective-c.mdx +++ b/src/pages/docs/getting-started/objective-c.mdx @@ -18,7 +18,7 @@ You'll establish a realtime connection to Ably and learn to publish and subscrib 1. [Sign up](https://ably.com/sign-up) for an Ably account. 2. Create a [new app](https://ably.com/accounts/any/apps/new), and create your first API key in the **API Keys** tab of the dashboard. -3. Your API key will need the `publish`, `subscribe`, `presence` and `history` [capabilities](/docs/auth/capabilities). +3. Your API key will need the `publish`, `subscribe`, `presence` and `history` [capabilities](/docs/platform/auth/capabilities). 4. Install Xcode and create a new Objective-C project. 5. Add the Ably [Pub/Sub Objective-C SDK](https://github.com/ably/ably-cocoa) as a dependency. @@ -70,7 +70,11 @@ Clients establish a connection with Ably when they instantiate an SDK instance. Open up the [dev console](https://ably.com/accounts/any/apps/any/console) of your first app before instantiating your client so that you can see what happens. -Replace the contents of your `main.m` file with functionality to instantiate the SDK and establish a connection to Ably. At the minimum you need to provide an authentication mechanism. Use an API key for simplicity, but you should use [token authentication](/docs/auth/token) in production environments. A [`clientId`](/docs/auth/identified-clients) ensures the client is identified, which is required to use certain features, such as presence: +Replace the contents of your `main.m` file with functionality to instantiate the SDK and establish a connection to Ably. At the minimum you need to provide an authentication mechanism. A [`clientId`](/docs/platform/auth/identified-clients) ensures the client is identified, which is required to use certain features, such as presence. + + ```objc @@ -79,7 +83,9 @@ Replace the contents of your `main.m` file with functionality to instantiate the int main(int argc, const char * argv[]) { @autoreleasepool { - // Initialize the Ably Realtime client + // WARNING: This uses an API key for simplicity. + // In production, use token authentication instead. + // See: https://ably.com/docs/platform/auth/token ARTClientOptions *options = [[ARTClientOptions alloc] initWithKey:@"{{API_KEY}}"]; options.clientId = @"my-first-client"; ARTRealtime *realtime = [[ARTRealtime alloc] initWithOptions:options]; @@ -227,7 +233,7 @@ The output will look similar to the following: Continue to explore the documentation with Objective-C as the selected language: -* Understand [token authentication](/docs/auth/token) before going to production. +* Understand [JWT token authentication](/docs/platform/auth/token#choosing-jwt) before going to production. * Understand how to effectively [manage connections](https://ably.com/docs/connect#close?lang=objc). * Explore more [advanced](/docs/pub-sub/advanced?lang=objc) Pub/Sub concepts. diff --git a/src/pages/docs/getting-started/php.mdx b/src/pages/docs/getting-started/php.mdx index 8e2a34b92d..db7fdd0e8e 100644 --- a/src/pages/docs/getting-started/php.mdx +++ b/src/pages/docs/getting-started/php.mdx @@ -66,7 +66,7 @@ ably login Clients can make REST API requests to Ably when they instantiate a REST SDK instance. This enables them to publish messages to channels and retrieve channel information. -Create a `get_started.php` file in your project and add the following code to instantiate the SDK and make requests to Ably. At the minimum you need to provide an authentication mechanism. Using an API key directly is fine for server-side environments like PHP where the key remains secure. However, for frontend clients, you should use [token authentication](/docs/auth/token) instead of exposing API keys. In this example, the [`clientId`](/docs/auth/identified-clients) will be the name of the client sending the message: +Create a `get_started.php` file in your project and add the following code to instantiate the SDK and make requests to Ably. At the minimum you need to provide an authentication mechanism. Using an API key directly is fine for server-side environments like PHP where the key remains secure. However, for frontend clients, you should use [token authentication](/docs/platform/auth/token) instead of exposing API keys. In this example, the [`clientId`](/docs/platform/auth/identified-clients) will be the name of the client sending the message: ```php @@ -76,6 +76,9 @@ require 'vendor/autoload.php'; use Ably\AblyRest; +// Server-side: Using API key is safe here. +// For frontend clients, use token authentication instead. +// See: https://ably.com/docs/platform/auth/token $ably = new AblyRest(['key' => '{{API_KEY}}', 'clientId' => 'my-first-client']); ``` @@ -230,7 +233,7 @@ The output will look similar to the following: Continue to explore the documentation with PHP as the selected language: -* Dive into [authenticating](/docs/auth/token#jwt?lang=php) your frontend applications with your PHP backend. +* Dive into [authenticating](/docs/platform/auth/token#jwt?lang=php) your frontend applications with your PHP backend. * Explore more [advanced](/docs/pub-sub/advanced?lang=php) Pub/Sub concepts. You can also explore the [Ably CLI](https://www.npmjs.com/package/@ably/cli) further, or visit the Pub/Sub [API references](/docs/api/rest-sdk?lang=php). diff --git a/src/pages/docs/getting-started/python.mdx b/src/pages/docs/getting-started/python.mdx index 85e63129eb..4ca8b4943b 100644 --- a/src/pages/docs/getting-started/python.mdx +++ b/src/pages/docs/getting-started/python.mdx @@ -63,7 +63,11 @@ ably login Clients establish a connection with Ably when they instantiate an SDK instance. This enables them to send and receive messages in realtime across channels. -Create a `get_started.py` file in your project and add the following function to instantiate the SDK and establish a connection to Ably. At the minimum you need to provide an authentication mechanism. Use an API key for simplicity, but you should use [token authentication](/docs/auth/token) in production environments. A [`client_id`](/docs/auth/identified-clients) ensures the client is identified, which is required to use certain features, such as presence: +Create a `get_started.py` file in your project and add the following function to instantiate the SDK and establish a connection to Ably. At the minimum you need to provide an authentication mechanism. A [`client_id`](/docs/platform/auth/identified-clients) ensures the client is identified, which is required to use certain features, such as presence. + + ```python @@ -71,7 +75,9 @@ import asyncio from ably import AblyRealtime async def get_started(): - # Initialize the Ably Realtime client + # Server-side: Using API key is safe here. + # For client-side apps, use token authentication instead. + # See: https://ably.com/docs/platform/auth/token async with AblyRealtime("{{API_KEY}}", client_id="my-first-client") as ably_realtime: def on_state_change(state_change): if state_change.current.value == "connected": @@ -198,7 +204,7 @@ The output will look similar to the following: Continue to explore the documentation with Python as the selected language: -* Understand [token authentication](/docs/auth/token) before going to production. +* Understand [JWT token authentication](/docs/platform/auth/token#choosing-jwt) before going to production. * Understand how to effectively [manage connections](https://ably.com/docs/connect#close?lang=python). * Explore more [advanced](/docs/pub-sub/advanced?lang=python) Pub/Sub concepts. diff --git a/src/pages/docs/getting-started/react-hooks.mdx b/src/pages/docs/getting-started/react-hooks.mdx index e748fa91e9..2282336d4d 100644 --- a/src/pages/docs/getting-started/react-hooks.mdx +++ b/src/pages/docs/getting-started/react-hooks.mdx @@ -40,12 +40,12 @@ React version 16.8 or above is required. ## Authenticate -An [API key](/docs/auth#api-keys) is required to authenticate with Ably. API keys are used either to authenticate directly with Ably using [basic authentication](/docs/auth/basic), or to generate tokens for untrusted clients using [token authentication](/docs/auth/token). +An [API key](/docs/platform/auth#api-keys) is required to authenticate with Ably. API keys are used either to authenticate directly with Ably using [basic authentication](/docs/platform/auth/basic), or to generate tokens for untrusted clients using [token authentication](/docs/platform/auth/token). [Sign up](https://ably.com/sign-up) to Ably to create an API key in the [dashboard](https://ably.com/dashboard) or use the [Control API](/docs/platform/account/control-api) to create an API programmatically. ## Usage diff --git a/src/pages/docs/getting-started/react-native.mdx b/src/pages/docs/getting-started/react-native.mdx index bc49ab67c2..006edbd7b9 100644 --- a/src/pages/docs/getting-started/react-native.mdx +++ b/src/pages/docs/getting-started/react-native.mdx @@ -16,7 +16,7 @@ You'll establish a realtime connection to Ably and learn to publish and subscrib 1. [Sign up](https://ably.com/sign-up) for a free Ably account. 2. Create a [new app](https://ably.com/accounts/any/apps/new), and create your first API key in the **API Keys** tab of the dashboard. -3. Your API key will need the `publish`, `subscribe`, `presence` and `history` [capabilities](/docs/auth/capabilities). +3. Your API key will need the `publish`, `subscribe`, `presence` and `history` [capabilities](/docs/platform/auth/capabilities). ### Create a React Native project @@ -95,6 +95,10 @@ The `AblyProvider` is required when using the `useAbly()` and `useConnectionStat Replace the contents of your `App.tsx` file with the following code to set up the `AblyProvider`: + + ```react // App.tsx @@ -106,7 +110,9 @@ import { SafeAreaView, Text, View } from 'react-native'; import './global.css'; -// Create your Ably Realtime client +// WARNING: This uses an API key for simplicity. +// In production, use token authentication instead. +// See: https://ably.com/docs/platform/auth/token const realtimeClient = new Ably.Realtime({ key: process.env.ABLY_API_KEY, clientId: 'my-first-client', @@ -175,6 +181,9 @@ In the [Set up AblyProvider](#prerequisites-setup-ably-provider) section, you ad ```react +// WARNING: This uses an API key for simplicity. +// In production, use token authentication instead. +// See: https://ably.com/docs/platform/auth/token const realtimeClient = new Ably.Realtime({ key: process.env.ABLY_API_KEY, clientId: 'my-first-client', @@ -182,7 +191,11 @@ const realtimeClient = new Ably.Realtime({ ``` -This code creates a new Realtime client instance, establishing a connection to Ably when your application starts. At the minimum you need to provide an authentication mechanism. While using an API key is fine for the purposes of this guide, you should use [token authentication](/docs/auth/token) in production environments. A [`clientId`](/docs/auth/identified-clients) ensures the client is identified, which is required to use certain features, such as presence. +This code creates a new Realtime client instance, establishing a connection to Ably when your application starts. At the minimum you need to provide an authentication mechanism. A [`clientId`](/docs/platform/auth/identified-clients) ensures the client is identified, which is required to use certain features, such as presence. + + To monitor the Ably connection state within your application, create a component that uses the `useConnectionStateListener()` hook provided by the Ably Pub/Sub SDK. This hook must be nested inside an `AblyProvider`, so the component must be placed within the `AblyProvider` in your application. @@ -682,7 +695,7 @@ Message number 5 Continue to explore the documentation with React as the selected language: -* Understand [token authentication](/docs/auth/token) before going to production. +* Understand [JWT token authentication](/docs/platform/auth/token#choosing-jwt) before going to production. * Understand how to effectively [manage connections](https://ably.com/docs/connect#close?lang=react). * Explore more [advanced](/docs/pub-sub/advanced?lang=react) Pub/Sub concepts. diff --git a/src/pages/docs/getting-started/react.mdx b/src/pages/docs/getting-started/react.mdx index 5b465a54be..df4b602450 100644 --- a/src/pages/docs/getting-started/react.mdx +++ b/src/pages/docs/getting-started/react.mdx @@ -115,6 +115,10 @@ The `AblyProvider` is required when using the `useAbly()` and `useConnectionStat Replace the contents of your `src/main.tsx` file with the following code to set up the `AblyProvider`: + + ```react // src/main.tsx @@ -125,7 +129,9 @@ import { createRoot } from 'react-dom/client'; import App from './App.tsx'; import './index.css'; -// Create your Ably Realtime client +// WARNING: This uses an API key for simplicity. +// In production, use token authentication instead. +// See: https://ably.com/docs/platform/auth/token const realtimeClient = new Ably.Realtime({ key: '{{API_KEY}}', clientId: 'my-first-client', @@ -181,6 +187,9 @@ In the [Set up AblyProvider](#prerequisites-setup-ably-provider) section, you ad ```react +// WARNING: This uses an API key for simplicity. +// In production, use token authentication instead. +// See: https://ably.com/docs/platform/auth/token const realtimeClient = new Ably.Realtime({ key: '{{API_KEY}}', clientId: 'my-first-client', @@ -188,7 +197,11 @@ const realtimeClient = new Ably.Realtime({ ``` -This code creates a new Realtime client instance, establishing a connection to Ably when your application starts. At the minimum you need to provide an authentication mechanism. While using an API key is fine for the purposes of this guide, you should use [token authentication](/docs/auth/token) in production environments. A [`clientId`](/docs/auth/identified-clients) ensures the client is identified, which is required to use certain features, such as presence. +This code creates a new Realtime client instance, establishing a connection to Ably when your application starts. At the minimum you need to provide an authentication mechanism. A [`clientId`](/docs/platform/auth/identified-clients) ensures the client is identified, which is required to use certain features, such as presence. + + To monitor the Ably connection state within your application, create a component that uses the `useConnectionStateListener()` hook provided by the Ably Pub/Sub SDK. This hook must be nested inside an `AblyProvider`, so the component must be placed within the `AblyProvider` in your application. @@ -627,7 +640,7 @@ Message number 5 Continue to explore the documentation with React as the selected language: -* Understand [token authentication](/docs/auth/token) before going to production. +* Understand [JWT token authentication](/docs/platform/auth/token#choosing-jwt) before going to production. * Understand how to effectively [manage connections](https://ably.com/docs/connect#close?lang=react). * Explore more [advanced](/docs/pub-sub/advanced?lang=react) Pub/Sub concepts. diff --git a/src/pages/docs/getting-started/ruby.mdx b/src/pages/docs/getting-started/ruby.mdx index 608c0a72b4..8c0b220cdc 100644 --- a/src/pages/docs/getting-started/ruby.mdx +++ b/src/pages/docs/getting-started/ruby.mdx @@ -14,7 +14,7 @@ You'll establish a realtime connection to Ably and learn to publish and subscrib 1. [Sign up](https://ably.com/sign-up) for an Ably account. 2. Create a [new app](https://ably.com/accounts/any/apps/new), and create your first API key in the **API Keys** tab of the dashboard. -3. Your API key will need the `publish`, `subscribe`, `presence` and `history` [capabilities](/docs/auth/capabilities). +3. Your API key will need the `publish`, `subscribe`, `presence` and `history` [capabilities](/docs/platform/auth/capabilities). 4. Install [Ruby](https://www.ruby-lang.org/en/documentation/installation/) version 2.7 or greater. 5. Create a new project and install the Ably [Pub/Sub Ruby SDK](https://github.com/ably/ably-ruby): @@ -63,7 +63,11 @@ Clients establish a connection with Ably when they instantiate an SDK instance. Open up the [dev console](https://ably.com/accounts/any/apps/any/console) of your first app before instantiating your client so that you can see what happens. -Create a `get_started.rb` file in your project and add the following function to instantiate the SDK and establish a connection to Ably. At the minimum you need to provide an authentication mechanism. Use an API key for simplicity, but you should use [token authentication](/docs/auth/token) in production environments. A [`client_id`](/docs/auth/identified-clients) ensures the client is identified, which is required to use certain features, such as presence: +Create a `get_started.rb` file in your project and add the following function to instantiate the SDK and establish a connection to Ably. At the minimum you need to provide an authentication mechanism. A [`client_id`](/docs/platform/auth/identified-clients) ensures the client is identified, which is required to use certain features, such as presence. + + ```ruby @@ -72,7 +76,9 @@ require 'eventmachine' def get_started EventMachine.run do - # Initialize the Ably Realtime client + # Server-side: Using API key is safe here. + # For client-side apps, use token authentication instead. + # See: https://ably.com/docs/platform/auth/token realtime_client = Ably::Realtime.new(key: '{{API_KEY}}', client_id: 'my-first-client') # Wait for the connection to be established @@ -201,7 +207,7 @@ The output will look similar to the following: Continue to explore the documentation with Ruby as the selected language: -* Understand [token authentication](/docs/auth/token) before going to production. +* Understand [JWT token authentication](/docs/platform/auth/token#choosing-jwt) before going to production. * Understand how to effectively [manage connections](https://ably.com/docs/connect#close?lang=ruby). * Explore more [advanced](/docs/pub-sub/advanced?lang=ruby) Pub/Sub concepts. diff --git a/src/pages/docs/getting-started/swift.mdx b/src/pages/docs/getting-started/swift.mdx index 2b33c2d6e3..9228542432 100644 --- a/src/pages/docs/getting-started/swift.mdx +++ b/src/pages/docs/getting-started/swift.mdx @@ -69,12 +69,19 @@ import Ably ``` -Create an instance of `ARTRealtime` with your API key and provide a `clientId`. While using an API key is fine for the purposes of this guide, you should use [token authentication](/docs/auth/token) in production environments. A [`clientId`](/docs/auth/identified-clients) ensures the client is identified, which is required to use certain features, such as presence. +Create an instance of `ARTRealtime` with your API key and provide a `clientId`. A [`clientId`](/docs/platform/auth/identified-clients) ensures the client is identified, which is required to use certain features, such as presence. + + This `ARTRealtime` instance is the main entry point for the realtime library. The `ARTRealtime` client connects to Ably as soon as it's instantiated, using a basic transport such as a raw TCP socket or a WebSocket: ```swift +// WARNING: This uses an API key for simplicity. +// In production, use token authentication instead. +// See: https://ably.com/docs/platform/auth/token let clientOptions = ARTClientOptions(key: "{{API_KEY}}") clientOptions.clientId = "my-first-client" let realtime = ARTRealtime(options: clientOptions) @@ -246,7 +253,7 @@ The output will look similar to the following: Continue to explore the documentation with Swift as the selected language: -* Understand [token authentication](/docs/auth/token) before going to production. +* Understand [JWT token authentication](/docs/platform/auth/token#choosing-jwt) before going to production. * Understand how to effectively [manage connections](https://ably.com/docs/connect#close?lang=ruby). * Explore more [advanced](/docs/pub-sub/advanced?lang=ruby) Pub/Sub concepts. diff --git a/src/pages/docs/guides/chat/build-livestream.mdx b/src/pages/docs/guides/chat/build-livestream.mdx index 72300d6d59..9cd6dc6b4e 100644 --- a/src/pages/docs/guides/chat/build-livestream.mdx +++ b/src/pages/docs/guides/chat/build-livestream.mdx @@ -371,5 +371,5 @@ Before you go live, review these key points: * Try out the [livestream chat demo](https://ably-livestream-chat-demo.vercel.app). * Read the [JavaScript / TypeScript](/docs/chat/getting-started/javascript) or [React](/docs/chat/getting-started/react) getting started guides. * Learn about how to add [chat moderation](/docs/chat/moderation). -* Understand [token authentication](/docs/auth/token#jwt) before going to production. +* Understand [token authentication](/docs/platform/auth/token#jwt) before going to production. * Learn how to set up [server-side batching](/docs/messages/batch#server-side). diff --git a/src/pages/docs/liveobjects/concepts/operations.mdx b/src/pages/docs/liveobjects/concepts/operations.mdx index 3353bfa619..7ca640bf0b 100644 --- a/src/pages/docs/liveobjects/concepts/operations.mdx +++ b/src/pages/docs/liveobjects/concepts/operations.mdx @@ -271,6 +271,10 @@ myCounter.increment(1); In the [REST API](/docs/liveobjects/rest-api-usage#updating-objects-by-id), the relationship between operations and object IDs is made explicit: + + ```shell curl -X POST https://main.realtime.ably.net/channels/my-channel/objects \ @@ -307,7 +311,7 @@ The following are the properties of an `ObjectMessage`: | Property | Description | |----------|-------------| | **id** | Unique ID assigned by Ably to this object message | -| **clientId** | The [ID of the client](/docs/auth/identified-clients) that published this operation | +| **clientId** | The [ID of the client](/docs/platform/auth/identified-clients) that published this operation | | **connectionId** | The ID of the connection used to publish this operation | | **timestamp** | The timestamp of when the object message was received by Ably, as milliseconds since the Unix epoch | | **channel** | The name of the channel the object message was published to | diff --git a/src/pages/docs/liveobjects/inband-objects.mdx b/src/pages/docs/liveobjects/inband-objects.mdx index ca30536478..d5416e880e 100644 --- a/src/pages/docs/liveobjects/inband-objects.mdx +++ b/src/pages/docs/liveobjects/inband-objects.mdx @@ -53,7 +53,7 @@ await channel.setOptions({ params: { objects: 'objects' } }); ## Subscribe to updates diff --git a/src/pages/docs/liveobjects/quickstart/java.mdx b/src/pages/docs/liveobjects/quickstart/java.mdx index 3594c5336a..9c004c0216 100644 --- a/src/pages/docs/liveobjects/quickstart/java.mdx +++ b/src/pages/docs/liveobjects/quickstart/java.mdx @@ -20,22 +20,22 @@ You will learn how to: ## Authentication -An [API key](/docs/auth#api-keys) is required to authenticate with Ably. API keys are used either to authenticate directly with Ably using [basic authentication](/docs/auth/basic), or to generate tokens for untrusted clients using [token authentication](/docs/auth/token). +An [API key](/docs/platform/auth#api-keys) is required to authenticate with Ably. API keys are used either to authenticate directly with Ably using [basic authentication](/docs/platform/auth/basic), or to generate tokens for untrusted clients using [token authentication](/docs/platform/auth/token). [Sign up](https://ably.com/sign-up) for a free account and create your own API key in the [dashboard](https://ably.com/dashboard) or use the [Control API](/docs/platform/account/control-api) to create an API key programmatically. -API keys and tokens have a set of [capabilities](/docs/auth/capabilities) assigned to them that specify which operations can be performed on which resources. The following capabilities are available for LiveObjects: +API keys and tokens have a set of [capabilities](/docs/platform/auth/capabilities) assigned to them that specify which operations can be performed on which resources. The following capabilities are available for LiveObjects: * `object-subscribe` - grants clients read access to LiveObjects, allowing them to get the root object and subscribe to updates. * `object-publish` - grants clients write access to LiveObjects, allowing them to perform mutation operations on objects. To use LiveObjects, an API key must have at least the `object-subscribe` capability. With only this capability, clients will have read-only access, preventing them from calling mutation methods on LiveObjects. -For the purposes of this guide, make sure your API key includes both `object-subscribe` and `object-publish` [capabilities](/docs/auth/capabilities) to allow full read and write access. +For the purposes of this guide, make sure your API key includes both `object-subscribe` and `object-publish` [capabilities](/docs/platform/auth/capabilities) to allow full read and write access. ## Install Ably Pub/Sub SDK diff --git a/src/pages/docs/liveobjects/quickstart/javascript.mdx b/src/pages/docs/liveobjects/quickstart/javascript.mdx index c634039382..1c4b9f1e4e 100644 --- a/src/pages/docs/liveobjects/quickstart/javascript.mdx +++ b/src/pages/docs/liveobjects/quickstart/javascript.mdx @@ -23,22 +23,22 @@ You will learn how to: ## Authentication -An [API key](/docs/auth#api-keys) is required to authenticate with Ably. API keys are used either to authenticate directly with Ably using [basic authentication](/docs/auth/basic), or to generate tokens for untrusted clients using [token authentication](/docs/auth/token). +An [API key](/docs/platform/auth#api-keys) is required to authenticate with Ably. API keys are used either to authenticate directly with Ably using [basic authentication](/docs/platform/auth/basic), or to generate tokens for untrusted clients using [token authentication](/docs/platform/auth/token). [Sign up](https://ably.com/sign-up) for a free account and create your own API key in the [dashboard](https://ably.com/dashboard) or use the [Control API](/docs/platform/account/control-api) to create an API key programmatically. -API keys and tokens have a set of [capabilities](/docs/auth/capabilities) assigned to them that specify which operations can be performed on which resources. The following capabilities are available for LiveObjects: +API keys and tokens have a set of [capabilities](/docs/platform/auth/capabilities) assigned to them that specify which operations can be performed on which resources. The following capabilities are available for LiveObjects: * `object-subscribe` - grants clients read access to LiveObjects, allowing them to get the channel object and subscribe to updates. * `object-publish` - grants clients write access to LiveObjects, allowing them to perform mutation operations on objects. To use LiveObjects, an API key must have at least the `object-subscribe` capability. With only this capability, clients will have read-only access, preventing them from calling mutation methods on LiveObjects. -For the purposes of this guide, make sure your API key includes both `object-subscribe` and `object-publish` [capabilities](/docs/auth/capabilities) to allow full read and write access. +For the purposes of this guide, make sure your API key includes both `object-subscribe` and `object-publish` [capabilities](/docs/platform/auth/capabilities) to allow full read and write access. ## Install Ably Pub/Sub SDK @@ -84,6 +84,10 @@ Reference the Ably Pub/Sub SDK and the Objects plugin within your HTML file: Instantiate an Ably Realtime client from the Pub/Sub SDK, providing the Objects plugin: + + ```javascript const realtimeClient = new Ably.Realtime({ key: '{{API_KEY}}', plugins: { LiveObjects } }); diff --git a/src/pages/docs/liveobjects/quickstart/swift.mdx b/src/pages/docs/liveobjects/quickstart/swift.mdx index bfc09fbf15..6bf28bc4e9 100644 --- a/src/pages/docs/liveobjects/quickstart/swift.mdx +++ b/src/pages/docs/liveobjects/quickstart/swift.mdx @@ -20,22 +20,22 @@ You will learn how to: ## Authentication -An [API key](/docs/auth#api-keys) is required to authenticate with Ably. API keys are used either to authenticate directly with Ably using [basic authentication](/docs/auth/basic), or to generate tokens for untrusted clients using [token authentication](/docs/auth/token). +An [API key](/docs/platform/auth#api-keys) is required to authenticate with Ably. API keys are used either to authenticate directly with Ably using [basic authentication](/docs/platform/auth/basic), or to generate tokens for untrusted clients using [token authentication](/docs/platform/auth/token). [Sign up](https://ably.com/sign-up) for a free account and create your own API key in the [dashboard](https://ably.com/dashboard) or use the [Control API](/docs/platform/account/control-api) to create an API key programmatically. -API keys and tokens have a set of [capabilities](/docs/auth/capabilities) assigned to them that specify which operations can be performed on which resources. The following capabilities are available for LiveObjects: +API keys and tokens have a set of [capabilities](/docs/platform/auth/capabilities) assigned to them that specify which operations can be performed on which resources. The following capabilities are available for LiveObjects: * `object-subscribe` - grants clients read access to LiveObjects, allowing them to get the root object and subscribe to updates. * `object-publish` - grants clients write access to LiveObjects, allowing them to perform mutation operations on objects. To use LiveObjects, an API key must have at least the `object-subscribe` capability. With only this capability, clients will have read-only access, preventing them from calling mutation methods on LiveObjects. -For the purposes of this guide, make sure your API key includes both `object-subscribe` and `object-publish` [capabilities](/docs/auth/capabilities) to allow full read and write access. +For the purposes of this guide, make sure your API key includes both `object-subscribe` and `object-publish` [capabilities](/docs/platform/auth/capabilities) to allow full read and write access. ## Install Ably Pub/Sub SDK @@ -65,6 +65,10 @@ import AblyLiveObjects Instantiate an Ably Realtime client from the Pub/Sub SDK, providing the LiveObjects plugin: + + ```swift let clientOptions = ARTClientOptions(key: "{{API_KEY}}") diff --git a/src/pages/docs/liveobjects/rest-api-usage.mdx b/src/pages/docs/liveobjects/rest-api-usage.mdx index b4145d2cd8..67d1789975 100644 --- a/src/pages/docs/liveobjects/rest-api-usage.mdx +++ b/src/pages/docs/liveobjects/rest-api-usage.mdx @@ -17,7 +17,7 @@ View the REST API [authentication](/docs/api/rest-api#authentication) documentat To use LiveObjects, an API key must have at least the `object-subscribe` capability. With only this capability, clients will have read-only access, preventing them from publishing operations. -In order to create or update objects, make sure your API key includes both `object-subscribe` and `object-publish` [capabilities](/docs/auth/capabilities) to allow full read and write access. +In order to create or update objects, make sure your API key includes both `object-subscribe` and `object-publish` [capabilities](/docs/platform/auth/capabilities) to allow full read and write access. ## Data values @@ -45,6 +45,10 @@ The key in the `data` object indicates the type of the value: The following request returns the entire channel object. + + ```shell curl "https://main.realtime.ably.net/channels/my-channel/object" \ diff --git a/src/pages/docs/livesync/index.mdx b/src/pages/docs/livesync/index.mdx index 8b145df32f..bc4428492b 100644 --- a/src/pages/docs/livesync/index.mdx +++ b/src/pages/docs/livesync/index.mdx @@ -19,7 +19,7 @@ Ably's [pub/sub channels](/docs/channels) are the mechanism used by LiveSync for ## Hosted database connectors -Take advantage of the Ably hosted database connectors to automatically publish changes from your database as messages on Ably channels. The hosted database connectors support controlling which events are routed to which channels, and using Ably's [Auth](/docs/auth) and [Capabilities](/docs/auth/capabilities) you can control which channels a client is allowed to access. +Take advantage of the Ably hosted database connectors to automatically publish changes from your database as messages on Ably channels. The hosted database connectors support controlling which events are routed to which channels, and using Ably's [Auth](/docs/platform/auth) and [Capabilities](/docs/platform/auth/capabilities) you can control which channels a client is allowed to access. Ably provides hosted connectors for: * [Postgres](/docs/livesync/postgres) diff --git a/src/pages/docs/livesync/mongodb/index.mdx b/src/pages/docs/livesync/mongodb/index.mdx index 2939fb868a..c6930f26aa 100644 --- a/src/pages/docs/livesync/mongodb/index.mdx +++ b/src/pages/docs/livesync/mongodb/index.mdx @@ -16,7 +16,7 @@ By using Ably Pub/Sub channels and SDKs, clients subscribing to messages publish The MongoDB database connector is enabled through an Ably integration rule. The rule will consume document changes from your MongoDB deployment via the MongoDB [Change Streams API](https://www.mongodb.com/docs/manual/changeStreams/). The integration rule exists as a "database connector" component that is entirely provisioned and managed by Ably and is fault-tolerant with automatic fail-over. -When a change event is received over the Change Streams API it is published to an Ably channel. When you configure the integration rule, you can specify how change events are mapped to individual Ably channels. Clients can then subscribe to database changes by subscribing to Ably channels. Ably [Auth](/docs/auth) and [Capabilities](/docs/auth/capabilities) control which channels a client can interact with. +When a change event is received over the Change Streams API it is published to an Ably channel. When you configure the integration rule, you can specify how change events are mapped to individual Ably channels. Clients can then subscribe to database changes by subscribing to Ably channels. Ably [Auth](/docs/platform/auth) and [Capabilities](/docs/platform/auth/capabilities) control which channels a client can interact with. ## Integration rule @@ -61,6 +61,10 @@ See the [channels documentation](/docs/pub-sub#subscribe) for further informatio The following is a simple example of instantiating a realtime client and subscribing to a channel: + + ```javascript // Instantiate the Realtime SDK @@ -106,9 +110,9 @@ The following is an example of a MongoDB change event that will be carried in th For the full schema and fields available on each type of change event, see the MongoDB [Change Event schema](https://www.mongodb.com/docs/v8.0/reference/change-events/) docs. -In the above example the client is using [basic authentication](/docs/auth/basic). In production applications your clients should use [token authentication](/docs/auth/token). +In the above example the client is using [basic authentication](/docs/platform/auth/basic). In production applications your clients should use [token authentication](/docs/platform/auth/token). -Clients require the `subscribe` [capability](/docs/auth/capabilities#capabilities-token) for the channels that your integration rule is publishing to. +Clients require the `subscribe` [capability](/docs/platform/auth/capabilities#capabilities-token) for the channels that your integration rule is publishing to. The following is an example capability for subscribing to the `myDocuments` channel: diff --git a/src/pages/docs/livesync/postgres/models.mdx b/src/pages/docs/livesync/postgres/models.mdx index 0801e0391a..068b799aa0 100644 --- a/src/pages/docs/livesync/postgres/models.mdx +++ b/src/pages/docs/livesync/postgres/models.mdx @@ -24,13 +24,13 @@ The following diagram provides a simplified overview of the Models SDK: ## Authenticate -An [API key](/docs/auth#api-keys) is required for your frontend app to authenticate with Ably. API keys are used either to authenticate directly with Ably using [basic authentication](/docs/auth/basic), or to generate tokens for untrusted clients using [token authentication](/docs/auth/token). +An [API key](/docs/platform/auth#api-keys) is required for your frontend app to authenticate with Ably. API keys are used either to authenticate directly with Ably using [basic authentication](/docs/platform/auth/basic), or to generate tokens for untrusted clients using [token authentication](/docs/platform/auth/token). -API keys and tokens have a set of [capabilities](/docs/auth/capabilities) assigned to them that specify which operations, such as `subscribe` or `publish` can be performed on which resources. To use the Models SDK, the API key requires the following capabilities, these two capabilities are discussed further down the page, but for the time being set these two and you can review them further along: +API keys and tokens have a set of [capabilities](/docs/platform/auth/capabilities) assigned to them that specify which operations, such as `subscribe` or `publish` can be performed on which resources. To use the Models SDK, the API key requires the following capabilities, these two capabilities are discussed further down the page, but for the time being set these two and you can review them further along: * `subscribe` for the channels you intend to subscribe to. * `history` if you intend to [sync from historical messages](#replay-from-history). @@ -382,7 +382,7 @@ By default, the events in the buffer are ordered numerically if the `message.id` ### Channels and models -In general, when designing your channels and models, aim for a 1:1:1 relationship between channels, models, and your domain model objects. Channels facilitate data partitioning and access control. For instance, in a task management app, each task can be represented by a model with its own channel, ensuring updates are specific to each task. Ably's [capabilities](/docs/auth/capabilities) are applied on a per channel basis allowing fine-grained access control for each data model in your application. +In general, when designing your channels and models, aim for a 1:1:1 relationship between channels, models, and your domain model objects. Channels facilitate data partitioning and access control. For instance, in a task management app, each task can be represented by a model with its own channel, ensuring updates are specific to each task. Ably's [capabilities](/docs/platform/auth/capabilities) are applied on a per channel basis allowing fine-grained access control for each data model in your application. For infrequently updated models, grouping them on the same channel may be viable, while frequently changing models benefit from individual channels. Starting with one channel per model and one model per domain object is a good baseline, adjusting as needed. diff --git a/src/pages/docs/livesync/postgres/quickstart.mdx b/src/pages/docs/livesync/postgres/quickstart.mdx index 525dff7fdd..72850cbcaf 100644 --- a/src/pages/docs/livesync/postgres/quickstart.mdx +++ b/src/pages/docs/livesync/postgres/quickstart.mdx @@ -17,7 +17,7 @@ git clone https://github.com/ably-labs/live-comments.git ### Create an Ably account -[Sign up](https://ably.com/signup) for a free account to get your own API key. Ensure that your API key includes the `subscribe` and `publish` [capabilities](/docs/auth/capabilities). +[Sign up](https://ably.com/signup) for a free account to get your own API key. Ensure that your API key includes the `subscribe` and `publish` [capabilities](/docs/platform/auth/capabilities). ### Set up a database diff --git a/src/pages/docs/messages/annotations.mdx b/src/pages/docs/messages/annotations.mdx index 4eafc6dd87..c1b9f4fb54 100644 --- a/src/pages/docs/messages/annotations.mdx +++ b/src/pages/docs/messages/annotations.mdx @@ -49,7 +49,7 @@ The `total.v1` summarization method counts the number of annotations of a given Deleting an annotation decrements the total count for that message. -Using `total.v1` does not attribute counts to individual clients in the summary; it maintains only a simple count per annotation type and does not organize counts by name. [Unidentified](/docs/auth/identified-clients#unidentified) clients can publish `total.v1` annotations. Use the [identified channel rule](/docs/channels#rules) if you want to prevent unidentified clients from publishing annotations. +Using `total.v1` does not attribute counts to individual clients in the summary; it maintains only a simple count per annotation type and does not organize counts by name. [Unidentified](/docs/platform/auth/identified-clients#unidentified) clients can publish `total.v1` annotations. Use the [identified channel rule](/docs/channels#rules) if you want to prevent unidentified clients from publishing annotations. If the same client publishes an annotation of a given type to the same message twice, the `total` count is incremented twice. @@ -65,7 +65,7 @@ If the same client publishes an annotation of a given type to the same message t ### Flag -The `flag.v1` summarization method counts how many distinct clients have published an annotation of a given type and maintains a list of those `clientId`s. Clients must be [identified](/docs/auth/identified-clients) to publish `flag.v1` annotations. +The `flag.v1` summarization method counts how many distinct clients have published an annotation of a given type and maintains a list of those `clientId`s. Clients must be [identified](/docs/platform/auth/identified-clients) to publish `flag.v1` annotations. Deleting an annotation decrements the total count for that message and removes the `clientId` from the list of clients that contributed to the summary. @@ -85,7 +85,7 @@ A given client can contribute to the summary only once per annotation type. ### Distinct -The `distinct.v1` summarization method counts how many unique clients have published an annotation with a given `name` for each annotation type along with the corresponding list of `clientId`s that published it. Clients must be [identified](/docs/auth/identified-clients) to publish `distinct.v1` annotations. +The `distinct.v1` summarization method counts how many unique clients have published an annotation with a given `name` for each annotation type along with the corresponding list of `clientId`s that published it. Clients must be [identified](/docs/platform/auth/identified-clients) to publish `distinct.v1` annotations. A given client can contribute to the summary for a particular annotation `name` only once, but the same client may publish additional annotations with different `name`s. @@ -112,7 +112,7 @@ Deleting an annotation removes the `clientId` from the list of clients that cont ### Unique -The `unique.v1` summarization method counts how many unique clients have published an annotation with a given `name` for each annotation type, while guaranteeing that each client contributes to the summary for only one `name` at a time. The summary for each annotation `name` holds a `total` count of the number of distinct clients that have published an annotation with that `name` along with the corresponding list of `clientId`s that published it. Clients must be [identified](/docs/auth/identified-clients) to publish `unique.v1` annotations. +The `unique.v1` summarization method counts how many unique clients have published an annotation with a given `name` for each annotation type, while guaranteeing that each client contributes to the summary for only one `name` at a time. The summary for each annotation `name` holds a `total` count of the number of distinct clients that have published an annotation with that `name` along with the corresponding list of `clientId`s that published it. Clients must be [identified](/docs/platform/auth/identified-clients) to publish `unique.v1` annotations. A given client can contribute to the summary for a particular annotation `name` only once. Publishing an annotation with a different `name` automatically removes that client from the summary for the previous `name` and adds them to the new one, updating the affected total values and list of `clientId`s. @@ -180,10 +180,14 @@ Deleting an annotation removes all contributions made by that `clientId` for tha To publish an annotation for a message, use the `annotations.publish()` method on a channel. Pass in either a [message](/docs/messages) instance or the `serial` of the message to annotate. This method will publish an annotation with the action `annotation.create`. -Certain annotation summarization methods require a client to be [identified](/docs/auth/identified-clients) for them to be able to publish an annotation. Their `clientId` will then be included in the associated published annotation. +Certain annotation summarization methods require a client to be [identified](/docs/platform/auth/identified-clients) for them to be able to publish an annotation. Their `clientId` will then be included in the associated published annotation. Specify the [annotation type](#annotation-types) using the `type` field of the annotation object. + + ```javascript // Create an Ably Realtime client specifying the clientId that will diff --git a/src/pages/docs/messages/batch.mdx b/src/pages/docs/messages/batch.mdx index a7ebf6b153..6f68090ea8 100644 --- a/src/pages/docs/messages/batch.mdx +++ b/src/pages/docs/messages/batch.mdx @@ -47,6 +47,10 @@ It is possible to publish messages to multiple channels with a single request. A The following is an example of a batch publish request using the [`request()`](/docs/api/rest-sdk#request) method to query the [batch REST API](/docs/api/rest-api#batch-publish): + + ```rest_javascript const ablyRest = new Ably.Rest({ key: '{{API_KEY}}' }) diff --git a/src/pages/docs/messages/index.mdx b/src/pages/docs/messages/index.mdx index d3ecbad18a..8498515f49 100644 --- a/src/pages/docs/messages/index.mdx +++ b/src/pages/docs/messages/index.mdx @@ -28,7 +28,7 @@ The following are the properties of a message: | **name** | The name of the message | | **data** | The contents of the message. Also known as the message payload | | **id** | Each message sent through Ably is assigned a unique ID, unless you provide your own ID, which serves as the [idempotency key](/docs/pub-sub/advanced#idempotency) | -| **clientId** | The [ID of the client](/docs/auth/identified-clients) that published the message | +| **clientId** | The [ID of the client](/docs/platform/auth/identified-clients) that published the message | | **connectionId** | The ID of the connection used to publish the message | | **timestamp** | The timestamp of when the message was first received by Ably, as milliseconds since the Unix epoch | | **extras** | A JSON object of arbitrary key-value pairs that may contain metadata, and/or ancillary payloads. Valid payloads include those related to [Push Notifications](/docs/push), [deltas](/docs/channels/options/deltas) and headers | diff --git a/src/pages/docs/messages/updates-deletes.mdx b/src/pages/docs/messages/updates-deletes.mdx index 917e92382a..1c7cad7476 100644 --- a/src/pages/docs/messages/updates-deletes.mdx +++ b/src/pages/docs/messages/updates-deletes.mdx @@ -43,6 +43,10 @@ To update an existing message, use the `updateMessage()` method on a REST or rea The message is identified by its `serial`, which is populated by Ably. To update a message, you need its serial - you can get this either from the return value of `publish()`, from a received message via subscription, or by querying history. + + ```javascript const realtime = new Ably.Realtime({ key: '{{API_KEY}}' }); @@ -109,11 +113,11 @@ Ably may opportunistically discard out of date updates to a given message, for e #### Capabilities -To update messages, clients need one of the following [capabilities](/docs/auth/capabilities): +To update messages, clients need one of the following [capabilities](/docs/platform/auth/capabilities): | Capability | Description | | ---------- | ----------- | -| **message-update-own** | Can update your own messages (more precisely, messages where the original publisher's `clientId` matches the updater's `clientId`, where both are [identified](/docs/auth/identified-clients)). | +| **message-update-own** | Can update your own messages (more precisely, messages where the original publisher's `clientId` matches the updater's `clientId`, where both are [identified](/docs/platform/auth/identified-clients)). | | **message-update-any** | Can update any message on the channel. | #### Operation metadata @@ -200,11 +204,11 @@ Since deletes are just updates with a different action, [as with updates](#updat #### Capabilities -To delete messages, clients need one of the following [capabilities](/docs/auth/capabilities): +To delete messages, clients need one of the following [capabilities](/docs/platform/auth/capabilities): | Capability | Description | | ---------- | ----------- | -| **message-delete-own** | Can delete your own messages (more precisely, messages where the original publisher's `clientId` matches the deleter's `clientId`, where both are [identified](/docs/auth/identified-clients)). | +| **message-delete-own** | Can delete your own messages (more precisely, messages where the original publisher's `clientId` matches the deleter's `clientId`, where both are [identified](/docs/platform/auth/identified-clients)). | | **message-delete-any** | Can delete any message on the channel. | #### Operation metadata @@ -322,7 +326,7 @@ This metadata will end up in the message's `version` property. See [Message vers To retrieve the most recent version of a specific message, use the `getMessage()` method on a REST channel. You can pass either the message's serial identifier as a string, or a message object with a `serial` property. -This operation requires the history [capability](/docs/auth/capabilities). +This operation requires the history [capability](/docs/platform/auth/capabilities). ```javascript @@ -348,7 +352,7 @@ const message = await channel.getMessage(msg); To retrieve all historical versions of a message, use the `getMessageVersions()` method. This returns a paginated result containing all versions of the message, including the original and all subsequent updates or delete operations, ordered by version. -This operation requires the history [capability](/docs/auth/capabilities). +This operation requires the history [capability](/docs/platform/auth/capabilities). ```javascript diff --git a/src/pages/docs/metadata-stats/metadata/rest.mdx b/src/pages/docs/metadata-stats/metadata/rest.mdx index bb9fda5836..c29d2ae395 100644 --- a/src/pages/docs/metadata-stats/metadata/rest.mdx +++ b/src/pages/docs/metadata-stats/metadata/rest.mdx @@ -19,6 +19,10 @@ Ably SDKs can query this endpoint using the generic [request()](/docs/api/rest-s The following is an example curl request to retrieve metadata from a channel: + + ```shell curl https://main.realtime.ably.net/channels/ \ @@ -27,7 +31,7 @@ curl https://main.realtime.ably.net/channels/ \ ## Retrieve a list of channels @@ -56,7 +60,7 @@ curl https://main.realtime.ably.net/channels \ Note that this API is intended for occasional use only. For example, to get an initial set of active channels that will be kept up-to-date using the [`[meta]channel.lifecycle`](/docs/metadata-stats/metadata/subscribe#channel-lifecycle) metachannel. The API is heavily rate-limited and only a single in-flight call is permitted to execute at any time. Further concurrent calls will be refused with the error code `42912`. ### Known limitations diff --git a/src/pages/docs/metadata-stats/metadata/subscribe.mdx b/src/pages/docs/metadata-stats/metadata/subscribe.mdx index ea3184f7c7..bbbf9a4a5b 100644 --- a/src/pages/docs/metadata-stats/metadata/subscribe.mdx +++ b/src/pages/docs/metadata-stats/metadata/subscribe.mdx @@ -24,7 +24,7 @@ The following is a list of available metachannels: | **[meta]log:push** | [log](#log): Similar to `[meta]log`, but only for errors that occur during delivery of Push Notifications | It is never possible to publish or be present on a metachannel, however you can query their [history](/docs/storage-history/history). diff --git a/src/pages/docs/metadata-stats/stats.mdx b/src/pages/docs/metadata-stats/stats.mdx index 1d3206f039..a1d14a2229 100644 --- a/src/pages/docs/metadata-stats/stats.mdx +++ b/src/pages/docs/metadata-stats/stats.mdx @@ -94,6 +94,10 @@ App-level statistics are also available programmatically using an [Ably SDK](/do The following is an example of querying app-level statistics using the Ably SDK [`stats` method](/docs/api/rest-sdk/statistics). + + ```realtime_javascript const realtime = new Ably.Realtime('{{API_KEY}}'); @@ -650,7 +654,7 @@ Channel metrics include all active [channels](/docs/channels) that are used to s ### API requests -API request metrics include all HTTP requests made to Ably, including those related to [token authentication](/docs/auth/token) and [push notifications](/docs/push). They do not include those requests made to the [Control API](/docs/platform/account/control-api). +API request metrics include all HTTP requests made to Ably, including those related to [token authentication](/docs/platform/auth/token) and [push notifications](/docs/push). They do not include those requests made to the [Control API](/docs/platform/account/control-api). | Metric | Description | | --- | --- | diff --git a/src/pages/docs/platform/account/app/api.mdx b/src/pages/docs/platform/account/app/api.mdx index 2421063578..5e25462b5a 100644 --- a/src/pages/docs/platform/account/app/api.mdx +++ b/src/pages/docs/platform/account/app/api.mdx @@ -9,7 +9,7 @@ redirect_from: The API keys tab lists all API keys associated with your account and provides information on each key's capabilities and restrictions. You can [create a new API key](#create) and manage an existing one. ## Create a new API key @@ -20,11 +20,11 @@ The following steps create a new API Key: * Assign a friendly name. * Give the new API key a descriptive name (e.g. chat app key) so it is easy to identify later. -To manage an API key: set [capabilities](/docs/auth/capabilities), define resource restrictions, use revocable tokens for security, and adjust key settings as needed. +To manage an API key: set [capabilities](/docs/platform/auth/capabilities), define resource restrictions, use revocable tokens for security, and adjust key settings as needed. ### Capabilities -[Capabilities](/docs/auth/capabilities) provide permissions required for managing message flow, user presence, notifications, channel information, and access controls, these depend on what you require the API key to have access to: +[Capabilities](/docs/platform/auth/capabilities) provide permissions required for managing message flow, user presence, notifications, channel information, and access controls, these depend on what you require the API key to have access to: | Capability | Description | | ---------- | ----------- | @@ -48,15 +48,15 @@ Set resource restrictions to control access to channels and queues, ranging from | Only queues | Access any queue but not channels. | | Selected channels and queues | Specify explicit rules for access. | -When specifying selected channels and queues, you can provide a comma-separated list of resources. Each resource can match a single channel (e.g., `channel-name`) or multiple channels using wildcards (e.g., `namespace:*`). Queues use the prefix `[queue]` and meta channels use `[meta]`. See [capabilities documentation](/docs/auth/capabilities#wildcards) for detailed wildcard syntax. +When specifying selected channels and queues, you can provide a comma-separated list of resources. Each resource can match a single channel (e.g., `channel-name`) or multiple channels using wildcards (e.g., `namespace:*`). Queues use the prefix `[queue]` and meta channels use `[meta]`. See [capabilities documentation](/docs/platform/auth/capabilities#wildcards) for detailed wildcard syntax. ### Revocable tokens -[Revocable tokens](/docs/auth/revocation#revocable-tokens) enhance security by allowing shorter token lifetimes and the ability to revoke tokens issued via the API key. +[Revocable tokens](/docs/platform/auth/revocation#revocable-tokens) enhance security by allowing shorter token lifetimes and the ability to revoke tokens issued via the API key. | Option | Description | | ------ | ----------- | diff --git a/src/pages/docs/platform/account/control-api.mdx b/src/pages/docs/platform/account/control-api.mdx index 844f23f165..d6526d7627 100644 --- a/src/pages/docs/platform/account/control-api.mdx +++ b/src/pages/docs/platform/account/control-api.mdx @@ -142,7 +142,7 @@ In the [Ably dashboard](https://ably.com/accounts/any) select the app you want t ![Application Settings](../../../../images/content/screenshots/control-api/application-settings.png) -The **App ID** is displayed under **Application settings**. It is also the first part of your API key for that app. For example, if your API key is `28AB6c.DEFi0Q`, then the App ID is `28AB6c`. You can find out more in the Ably Help Center article [what is an app API key?](/docs/auth#api-key). +The **App ID** is displayed under **Application settings**. It is also the first part of your API key for that app. For example, if your API key is `28AB6c.DEFi0Q`, then the App ID is `28AB6c`. You can find out more in the Ably Help Center article [what is an app API key?](/docs/platform/auth#api-key). ## Examples @@ -463,7 +463,7 @@ You can use the Control API to manage Ably API keys. The main operations are: * Update a key * Revoke a key -Control API enables you to create a key that has different [capabilities](/docs/auth/capabilities) for different channels. +Control API enables you to create a key that has different [capabilities](/docs/platform/auth/capabilities) for different channels. #### List API keys diff --git a/src/pages/docs/platform/account/enterprise-customization.mdx b/src/pages/docs/platform/account/enterprise-customization.mdx index 92197df19d..cfcb397ca6 100644 --- a/src/pages/docs/platform/account/enterprise-customization.mdx +++ b/src/pages/docs/platform/account/enterprise-customization.mdx @@ -67,7 +67,7 @@ To use a custom endpoint, perform the following steps: ### Decide whether to use an Ably subdomain, or your own domain -Ably client libraries connect to the `main.realtime.ably.net` domain by default. This domain is used by both WebSocket and other realtime connections from the Ably client libraries, as well as all REST-based requests. It is optimized for all standard HTTP-based request types, including all [REST requests](/docs/api/rest-api), [authentication requests](/docs/auth), and Comet and JSONP fallback when WebSockets cannot be used. +Ably client libraries connect to the `main.realtime.ably.net` domain by default. This domain is used by both WebSocket and other realtime connections from the Ably client libraries, as well as all REST-based requests. It is optimized for all standard HTTP-based request types, including all [REST requests](/docs/api/rest-api), [authentication requests](/docs/platform/auth), and Comet and JSONP fallback when WebSockets cannot be used. When you request a custom endpoint, you have the following options: diff --git a/src/pages/docs/platform/account/users.mdx b/src/pages/docs/platform/account/users.mdx index ad020cdaba..496b46f06a 100644 --- a/src/pages/docs/platform/account/users.mdx +++ b/src/pages/docs/platform/account/users.mdx @@ -29,7 +29,7 @@ User roles have the following permissions: | Configure own [2FA](/docs/platform/account/2fa) | ✓ | - | ✓ | ✓ | | [Invite new users](#invite) | - | - | ✓ | ✓ | | [Remove existing users](#remove) | - | - | ✓ | ✓ | -| Manage [API keys](/docs/auth) | - | - | ✓ | ✓ | +| Manage [API keys](/docs/platform/auth) | - | - | ✓ | ✓ | | Manage app configuration | - | - | ✓ | ✓ | | Manage app settings | - | - | ✓ | ✓ | | Create apps | - | - | ✓ | ✓ | diff --git a/src/pages/docs/platform/ai-llms/index.mdx b/src/pages/docs/platform/ai-llms/index.mdx index e350126b0e..2db961595e 100644 --- a/src/pages/docs/platform/ai-llms/index.mdx +++ b/src/pages/docs/platform/ai-llms/index.mdx @@ -16,7 +16,7 @@ Every documentation page is available as clean markdown by appending `.md` to th - `https://ably.com/docs/channels.md` - Channels documentation - `https://ably.com/docs/chat/rooms.md` - Chat rooms documentation -- `https://ably.com/docs/auth.md` - Authentication documentation +- `https://ably.com/docs/platform/auth.md` - Authentication documentation These markdown versions strip out navigation and UI elements, providing clean content that LLMs can easily parse and understand. @@ -112,7 +112,7 @@ Use **API reference docs** when: Never infer or approximate APIs—always rely on API reference pages. -#### Product and feature docs (`/docs/{product}/`, `/docs/channels/`, `/docs/auth/`, etc.) +#### Product and feature docs (`/docs/{product}/`, `/docs/channels/`, `/docs/platform/auth/`, etc.) Use **product and feature docs** for: - Understanding how specific features work - Configuration options and parameters diff --git a/src/pages/docs/auth/basic.mdx b/src/pages/docs/platform/auth/basic.mdx similarity index 91% rename from src/pages/docs/auth/basic.mdx rename to src/pages/docs/platform/auth/basic.mdx index bdcc9a6b02..103112855e 100644 --- a/src/pages/docs/auth/basic.mdx +++ b/src/pages/docs/platform/auth/basic.mdx @@ -1,9 +1,11 @@ --- title: Basic auth meta_description: "Basic authentication allows you to authenticate a secure server using an Ably API key and secret." +redirect_from: + - /docs/auth/basic --- -Basic authentication is the simplest way to authenticate with Ably. It requires passing an [API key](/docs/auth#api-key) when instancing an SDK. +Basic authentication is the simplest way to authenticate with Ably. It requires passing an [API key](/docs/platform/auth#api-key) when instancing an SDK.