A client ID, used for identifying this client when publishing messages or for presence purposes. The clientId
can be any non-empty string, except it cannot contain a *
. 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 is raised if a clientId
specified here conflicts with the clientId
implicit in the token. Find out more about identified clients.
Instructs the library to get a new token immediately. When using the realtime client, it upgrades the current realtime connection to use the new token, or if not connected, initiates a connection to Ably, once the new token has been obtained. Also stores any TokenParams and AuthOptions passed in as the new defaults, to be used for all subsequent implicit or explicit token requests. Any TokenParams and AuthOptions objects passed in entirely replace, as opposed to being merged with, the current client library saved values.
A promise which, upon success, will be fulfilled with a TokenDetails object. Upon failure, the promise will be rejected with an ErrorInfo object which explains the error.
Optional
tokenParams: TokenParams
A TokenParams object.
Optional
authOptions: AuthOptions
An AuthOptions object.
Creates and signs an Ably TokenRequest based on the specified (or if none specified, the client library stored) TokenParams and AuthOptions. Note this can only be used when the API key
value is available locally. Otherwise, the Ably TokenRequest must be obtained from the key owner. Use this to generate an Ably TokenRequest in order to implement an Ably Token request callback for use by other clients. Both TokenParams and AuthOptions 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
request. Values passed in are used instead of, rather than being merged with, the default values. To understand why an Ably TokenRequest may be issued to clients in favor of a token, see Token Authentication explained.
A promise which, upon success, will be fulfilled with a TokenRequest object. Upon failure, the promise will be rejected with an ErrorInfo object which explains the error.
Optional
tokenParams: TokenParams
A TokenParams object.
Optional
authOptions: AuthOptions
An AuthOptions object.
Calls the requestToken
REST API endpoint to obtain an Ably Token according to the specified TokenParams and AuthOptions. Both TokenParams and AuthOptions 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
request. Values passed in are used instead of, rather than being merged with, the default values. To understand why an Ably TokenRequest may be issued to clients in favor of a token, see Token Authentication explained.
A promise which, upon success, will be fulfilled with a TokenDetails object. Upon failure, the promise will be rejected with an ErrorInfo object which explains the error.
Optional
TokenParams: TokenParams
A TokenParams object.
Optional
authOptions: AuthOptions
An AuthOptions object.
Revokes the tokens specified by the provided array of TokenRevocationTargetSpecifiers. 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 for more information.
A promise which, upon success, will be fulfilled with a BatchResult containing information about the result of the token revocation request for each provided [TokenRevocationTargetSpecifier
]TokenRevocationTargetSpecifier. Upon failure, the promise will be rejected with an ErrorInfo object which explains the error.
An array of TokenRevocationTargetSpecifier objects.
Optional
options: TokenRevocationOptions
A set of options which are used to modify the revocation request.
Generated using TypeDoc
Creates Ably TokenRequest objects and obtains Ably Tokens from Ably to subsequently issue to less trusted clients.