A client that offers a simple stateless API to interact directly with Ably's REST API.

Hierarchy

Constructors

Properties

An AuthPromise object.

A Channels object.

A PushPromise object.

Callbacks: typeof RestCallbacks

A callback based version of the library

Crypto: Crypto

The cryptographic functions available in the library.

Message: MessageStatic

Static utilities related to messages.

PresenceMessage: PresenceMessageStatic

Static utilities related to presence messages.

Promise: typeof RestPromise

A promisified version of the library (use this if you prefer to use Promises or async/await instead of callbacks)

Methods

  • Makes a REST request to a provided path. This is provided as a convenience for developers who wish to use REST API functionality that is either not documented or is not yet included in the public API, without having to directly handle features such as authentication, paging, fallback hosts, MsgPack and JSON support.

    Returns

    A promise which, upon success, will be fulfilled with an HttpPaginatedResponse response object returned by the HTTP request. This response object will contain an empty or JSON-encodable object. Upon failure, the promise will be rejected with an ErrorInfo object which explains the error.

    Type Parameters

    • T = any

    Parameters

    • method: string

      The request method to use, such as GET, POST.

    • path: string

      The request path.

    • Optional params: any

      The parameters to include in the URL query of the request. The parameters depend on the endpoint being queried. See the REST API reference for the available parameters of each endpoint.

    • Optional body: any

      The JSON body of the request.

    • Optional headers: any

      Additional HTTP headers to include in the request.

    Returns Promise<HttpPaginatedResponse<T>>

  • Queries the REST /stats API and retrieves your application's usage statistics. Returns a PaginatedResult object, containing an array of Stats objects. See the Stats docs.

    Returns

    A promise which, upon success, will be fulfilled with a PaginatedResult object containing an array of Stats objects. Upon failure, the promise will be rejected with an ErrorInfo object which explains the error.

    Parameters

    • Optional params: any

      A set of parameters which are used to specify which statistics should be retrieved. This parameter should be a StatsParams object. For reasons of backwards compatibility this parameter will also accept any; this ability will be removed in the next major release of this SDK. If you do not provide this argument, then this method will use the default parameters described in the StatsParams interface.

    Returns Promise<PaginatedResult<Stats>>

  • Retrieves the time from the Ably service as milliseconds since the Unix epoch. Clients that do not have access to a sufficiently well maintained time source and wish to issue Ably TokenRequests with a more accurate timestamp should use the queryTime property instead of this method.

    Returns

    A promise which, upon success, will be fulfilled with the time as milliseconds since the Unix epoch. Upon failure, the promise will be rejected with an ErrorInfo object which explains the error.

    Returns Promise<number>

Generated using TypeDoc