# Types
The Ably REST client library defines both data types and option types. Data types are used to represent object such as messages; Option types are used in method arguments.
Where client libraries support both Realtime and REST APIs, the types are shared between both clients.
All types are always classes or their respective equivalent for each language implementation. Options on the other hand, may often support both typed option classes or more flexible key value objects such as a Hash or plain JavaScript object.
If you are interested in finding out more about the exact types and options definitions in each language, we recommend you download [our open source libraries](https://ably.com/download) and review the code.
## REST Data types
### io.ably.lib.types.AblyExceptionAbly::Exceptions::BaseAblyExceptionAblyExceptionAbly\Exceptions\AblyExceptionIO.Ably.AblyException
An `AblyException` is an exception encapsulating error information containing an Ably-specific error code and generic status code, where applicable.
#### PropertiesMembersAttributes
| Parameter | Description | Type |
|-----------|-------------|------|
| errorInfoErrorInfo | [`ErrorInfo`](https://ably.com/docs/api/realtime-sdk/types.md#error-info) corresponding to this exception, where applicable | `ErrorInfo` |
| Parameter | Description | Type |
|-----------|-------------|------|
| code | Ably error code (see [ably-common/protocol/errors.json](https://github.com/ably/ably-common/blob/main/protocol/errors.json)) | `Integer` |
| statusCodestatus_code | HTTP Status Code corresponding to this error, where applicable | `Integer` |
| message | Additional message information, where available | `String` |
A `BaseAblyException`An `AblyException` is an exception encapsulating error information containing an Ably-specific error code and generic status code, where applicable.
### ChannelDetails
`ChannelDetails` is an object returned when requesting or receiving [channel metadata](https://ably.com/docs/metadata-stats/metadata.md). It contains information on the channel itself, along with the current state of the channel in the [ChannelStatus](#channel-status) object.
| Parameter | Description | Type |
|-----------|-------------|------|
| channelId | The required name of the channel including any qualifier, if any | `string` |
| region | In events relating to the activity of a channel in a specific region, this optionally identifies the region | `string` |
| isGlobalMaster | In events relating to the activity of a channel in a specific region, this optionally identifies whether or not that region is responsible for global coordination of the channel | `boolean` |
| status | An optional [`ChannelStatus`](#channel-status) instance | [ChannelStatus](#channel-status) |
The following is an example of a `ChannelDetails` JSON object:
```json
{
"channelId": "foo",
"status": {
"isActive": true,
"occupancy": {
"metrics": {
"connections": 1,
"publishers": 1,
"subscribers": 1,
"presenceConnections": 1,
"presenceMembers": 0,
"presenceSubscribers": 1,
"objectPublishers": 1,
"objectSubscribers": 1
}
}
}
}
```
### ChannelDetails.ChannelStatus
`ChannelStatus` is contained within the [`ChannelDetails`](#channel-details) object, and optionally contains an [Occupancy](#occupancy) object.
| Parameter | Description | Type |
|-----------|-------------|------|
| isActive | A required boolean value indicating whether the channel that is the subject of the event is active. For events indicating regional activity of a channel this indicates activity in that region, not global activity | `boolean` |
| occupancy | An optional [`Occupancy`](#occupancy) instance indicating the occupancy of the channel. For events indicating regional activity of a channel this indicates activity in that region, not global activity | [Occupancy](#occupancy) |
### ChannelDetails.ChannelStatus.Occupancy
Occupancy is optionally contained within the [`ChannelStatus`](#channel-status) object, and contains metadata relating to the occupants of the channel. This is usually contained within the `occupancy` attribute of the [`ChannelStatus`](#channel-status) object.
The `occupancy` attribute contains the `metrics` attribute, which contains the following members:
| Parameter | Description | Type |
|-----------|-------------|------|
| connections | The number of connections | `integer` |
| publishers | The number of connections attached to the channel that are authorised to publish | `integer` |
| subscribers | The number of connections attached that are authorised to subscribe to messages | `integer` |
| presenceSubscribers | The number of connections that are authorised to subscribe to presence messages | `integer` |
| presenceConnections | The number of connections that are authorised to enter members into the presence channel | `integer` |
| presenceMembers | The number of members currently entered into the presence channel | `integer` |
| objectPublishers | The number of connections that are authorised to publish updates to objects on the channel | `integer` |
| objectSubscribers | The number of connections that are authorised to subscribe to objects on the channel | `integer` |
### ErrorInfoARTErrorInfoio.ably.lib.types.ErrorInfoAbly::Models::ErrorInfoAbly\Models\ErrorInfoIO.Ably.ErrorInfoably.ErrorInfo
An `ErrorInfo` is a type encapsulating error information containing an Ably-specific error code and generic status code.
#### PropertiesMembersAttributes
| Parameter | Description | Type |
|-----------|-------------|------|
| codeCode | Ably error code (see [ably-common/protocol/errors.json](https://github.com/ably/ably-common/blob/main/protocol/errors.json)) | `Integer` |
| statusCodestatus_codeStatusCode | HTTP Status Code corresponding to this error, where applicable | `Integer` |
| messageMessage | Additional message information, where available | `String` |
| causeCause | Information pertaining to what caused the error where available | `ErrorInfo` |
| hrefHref | Ably may additionally include a URL to get more help on this error | `String` |
| Parameter | Description | Type |
|-----------|-------------|------|
| code | Ably error code (see [ably-common/protocol/errors.json](https://github.com/ably/ably-common/blob/main/protocol/errors.json)) | `Integer` |
| statusCode | HTTP Status Code corresponding to this error, where applicable | `Integer` |
| message | Additional message information, where available | `String` |
| cause | Information pertaining to what caused the error where available | `ErrorInfo` |
| href | Ably may additionally include a URL to get more help on this error | `String` |
| requestId | Request ID with which the error can be identified | `String` |
#### Error nesting
ErrorInfo objects can contain nested errors through the `cause` property, allowing you to trace the root cause of failures. When an operation fails due to underlying system errors, the main `ErrorInfo` provides the high-level failure reason while the nested `cause` contains more specific details about what went wrong.
One example of ErrorInfo nesting is [80019: Auth server rejecting request](https://ably.com/docs/platform/errors/codes.md#80019) where the main error indicates token renewal failed, while the nested `cause` contains the specific HTTP error from the auth server.
The following example demonstrates how to handle nested errors:
```javascript
function handleError(error) {
console.log(`Main error: ${error.code} - ${error.message}`);
// Check for nested error
if (error.cause) {
console.log(`Root cause: ${error.cause.code} - ${error.cause.message}`);
// Handle further nesting if needed
if (error.cause.cause) {
console.log(`Deeper cause: ${error.cause.cause.code} - ${error.cause.cause.message}`);
}
}
}
```
```nodejs
function handleError(error) {
console.log(`Main error: ${error.code} - ${error.message}`);
// Check for nested error
if (error.cause) {
console.log(`Root cause: ${error.cause.code} - ${error.cause.message}`);
// Handle further nesting if needed
if (error.cause.cause) {
console.log(`Deeper cause: ${error.cause.cause.code} - ${error.cause.cause.message}`);
}
}
}
```
```swift
func handleError(_ error: ARTErrorInfo) {
print("Main error: \(error.code) - \(error.message)")
if let cause = error.cause {
print("Root cause: \(cause.code) - \(cause.message)")
if let deeperCause = cause.cause {
print("Deeper cause: \(deeperCause.code) - \(deeperCause.message)")
}
}
}
```
```objc
- (void)handleError:(ARTErrorInfo *)error {
NSLog(@"Main error: %ld - %@", (long)error.code, error.message);
if (error.cause) {
NSLog(@"Root cause: %ld - %@", (long)error.cause.code, error.cause.message);
if (error.cause.cause) {
NSLog(@"Deeper cause: %ld - %@", (long)error.cause.cause.code, error.cause.cause.message);
}
}
}
```
```flutter
void handleError(ably.ErrorInfo error) {
print('Main error: ${error.code} - ${error.message}');
if (error.cause != null) {
print('Root cause: ${error.cause!.code} - ${error.cause!.message}');
if (error.cause!.cause != null) {
print('Deeper cause: ${error.cause!.cause!.code} - ${error.cause!.cause!.message}');
}
}
}
```
```java
public void handleError(ErrorInfo error) {
System.out.println("Main error: " + error.code + " - " + error.message);
if (error.cause != null) {
System.out.println("Root cause: " + error.cause.code + " - " + error.cause.message);
if (error.cause.cause != null) {
System.out.println("Deeper cause: " + error.cause.cause.code + " - " + error.cause.cause.message);
}
}
}
```
```csharp
void HandleError(ErrorInfo error)
{
Console.WriteLine($"Main error: {error.Code} - {error.Message}");
if (error.Cause != null)
{
Console.WriteLine($"Root cause: {error.Cause.Code} - {error.Cause.Message}");
if (error.Cause.Cause != null)
{
Console.WriteLine($"Deeper cause: {error.Cause.Cause.Code} - {error.Cause.Cause.Message}");
}
}
}
```
```ruby
def handle_error(error)
puts "Main error: #{error.code} - #{error.message}"
if error.cause
puts "Root cause: #{error.cause.code} - #{error.cause.message}"
if error.cause.cause
puts "Deeper cause: #{error.cause.cause.code} - #{error.cause.cause.message}"
end
end
end
```
```python
def handle_error(error):
print(f"Main error: {error.code} - {error.message}")
if error.cause:
print(f"Root cause: {error.cause.code} - {error.cause.message}")
if error.cause.cause:
print(f"Deeper cause: {error.cause.cause.code} - {error.cause.cause.message}")
```
```php
function handleError($error) {
echo "Main error: " . $error->code . " - " . $error->message . "\n";
if ($error->cause) {
echo "Root cause: " . $error->cause->code . " - " . $error->cause->message . "\n";
if ($error->cause->cause) {
echo "Deeper cause: " . $error->cause->cause->code . " - " . $error->cause->cause->message . "\n";
}
}
}
```
```go
func handleError(err *ErrorInfo) {
fmt.Printf("Main error: %d - %s\n", err.Code, err.Message)
if err.Cause != nil {
fmt.Printf("Root cause: %d - %s\n", err.Cause.Code, err.Cause.Message)
if err.Cause.Cause != nil {
fmt.Printf("Deeper cause: %d - %s\n", err.Cause.Cause.Code, err.Cause.Cause.Message)
}
}
}
```
### MessageARTMessageio.ably.lib.types.MessageAbly::Models::MessageAbly\Models\MessageIO.Ably.Message
A `Message` represents an individual message that is sent to or received from Ably.
#### nameName
The event name, if provided.
_Type: `String`_
#### dataData
The message payload, if provided.
_Type: `String`, `StringBuffer`, `JSON Object``String`, `ByteArray`, `JSONObject`, `JSONArray``String`, `byte[]`, plain C# object that can be serialized to JSON`String`, `Binary` (ASCII-8BIT String), `Hash`, `Array``String`, `Bytearray`, `Dict`, `List``String`, `Binary String`, `Associative Array`, `Array``NSString *`, `NSData *`, `NSDictionary *`, `NSArray *``String`, `NSData`, `Dictionary`, `Array``String`, `Map`, `List`_
#### extrasExtras
Metadata and/or ancillary payloads, if provided. Valid payloads include [`push`](https://ably.com/docs/push/publish.md#payload), `headers` (a map of strings to strings for arbitrary customer-supplied metadata), [`ephemeral`](https://ably.com/docs/pub-sub/advanced.md#ephemeral), and [`privileged`](https://ably.com/docs/platform/integrations/webhooks.md#skipping) objects.
_Type: `JSONObject`, `JSONArray`plain C# object that can be converted to JSON`JSON Object``Hash`, `Array``Dict`, `List``Dictionary`, `Array``NSDictionary *`, `NSArray *``Associative Array`, `Array``JSON Object`_
#### idId
A Unique ID assigned by Ably to this message.
_Type: `String`_
#### clientIdClientIdclient_id
The client ID of the publisher of this message.
_Type: `String`_
#### connectionIdConnectionIdconnection_id
The connection ID of the publisher of this message.
_Type: `String`_
#### connectionKeyConnectionKeyconnection_key
A connection key, which can optionally be included for a REST publish as part of the [publishing on behalf of a realtime client functionality](https://ably.com/docs/pub-sub/advanced.md#publish-on-behalf).
_Type: `String`_
#### timestampTimestamp
Timestamp when the message was first received by the Ably, as milliseconds since the epocha `Time` object.
_Type: `Integer``Long Integer``DateTimeOffset``Time``NSDate`_
#### encodingEncoding
This will typically be empty as all messages received from Ably are automatically decoded client-side using this value. However, if the message encoding cannot be processed, this attribute will contain the remaining transformations not applied to the `data` payload.
_Type: `String`_
#### action
The action type of the message, one of the [`MessageAction`](https://ably.com/docs/api/realtime-sdk/types.md#message-action) enum values.
_Type: `int enum { MESSAGE_CREATE, MESSAGE_UPDATE, MESSAGE_DELETE, META, MESSAGE_SUMMARY, MESSAGE_APPEND }`_
#### serial
A server-assigned identifier that will be the same in all future updates of this message. It can be used to add annotations to a message. Serial will only be set if you enable annotations in [channel rules](https://ably.com/docs/channels.md#rules).
_Type: `String`_
#### annotations
An object containing information about annotations that have been made to the object.
_Type: [`MessageAnnotations`](https://ably.com/docs/api/realtime-sdk/types.md#message-annotations)_
### Message constructors
#### Message.fromEncoded
`Message.fromEncoded(Object encodedMsg, ChannelOptions channelOptions?) -> Message`
A static factory method to create a [`Message`](https://ably.com/docs/api/realtime-sdk/types.md#message) from a deserialized `Message`-like object encoded using Ably's wire protocol.
##### Parameters
| Parameter | Description | Type |
|-----------|-------------|------|
| encodedMsg | A `Message`-like deserialized object | `Object` |
| channelOptions | An optional [`ChannelOptions`](https://ably.com/docs/api/realtime-sdk/types.md#channel-options). If you have an encrypted channel, use this to allow the library to decrypt the data | `Object` |
##### Returns
A [`Message`](https://ably.com/docs/api/realtime-sdk/types.md#message) object
#### Message.fromEncodedArray
`Message.fromEncodedArray(Object[] encodedMsgs, ChannelOptions channelOptions?) -> Message[]`
A static factory method to create an array of [`Messages`](https://ably.com/docs/api/realtime-sdk/types.md#message) from an array of deserialized `Message`-like object encoded using Ably's wire protocol.
##### Parameters
| Parameter | Description | Type |
|-----------|-------------|------|
| encodedMsgs | An array of `Message`-like deserialized objects | `Array` |
| channelOptions | An optional [`ChannelOptions`](https://ably.com/docs/api/realtime-sdk/types.md#channel-options). If you have an encrypted channel, use this to allow the library to decrypt the data | `Object` |
##### Returns
An `Array` of [`Message`](https://ably.com/docs/api/realtime-sdk/types.md#message) objects
### PresenceMessageARTPresenceMessageio.ably.lib.types.PresenceMessageAbly::Models::PresenceMessageAbly\Models\PresenceMessageIO.Ably.PresenceMessage
A `PresenceMessage` represents an individual presence update that is sent to or received from Ably.
#### PropertiesMembersAttributes
| Parameter | Description | Type |
|-----------|-------------|------|
| actionAction | The event signified by a PresenceMessage. See [`PresenceMessage.action`](https://ably.com/docs/api/realtime-sdk/types.md#presence-action)[`PresenceMessage.action`](https://ably.com/docs/api/realtime-sdk/types.md#presence-action)[`Presence action`](https://ably.com/docs/api/realtime-sdk/types.md#presence-action)[`PresenceAction`](https://ably.com/docs/api/realtime-sdk/types.md#presence-action)[`PresenceMessage::ACTION`](https://ably.com/docs/api/realtime-sdk/types.md#presence-action)[`PresenceMessage::ACTION`](https://ably.com/docs/api/realtime-sdk/types.md#presence-action)[`PresenceMessage.action`](https://ably.com/docs/api/realtime-sdk/types.md#presence-action)[`PresenceMessage::action`](https://ably.com/docs/api/realtime-sdk/types.md#presence-action)[`Presence action`](https://ably.com/docs/api/realtime-sdk/types.md#presence-action) | `enum { ABSENT, PRESENT, ENTER, LEAVE, UPDATE }``enum { Absent, Present, Enter, Leave, Update }``int enum { ABSENT, PRESENT, ENTER, LEAVE, UPDATE }``int enum { ABSENT, PRESENT, ENTER, LEAVE, UPDATE }``enum { :absent, :present, :enter, :leave, :update }``const PresenceMessage::ABSENT,PRESENT,ENTER,LEAVE,UPDATE``ARTPresenceAction``const PresenceMessage::PresenceAbsent,PresencePresent,PresenceEnter,PresenceLeave,PresenceUpdate` |
| dataData | The presence update payload, if provided | `String`, `ByteArray`, `JSONObject`, `JSONArray``String`, `byte[]`, plain C# object that can be converted to Json`String`, `StringBuffer`, `JSON Object``String`, `[]byte``String`, `Binary` (ASCII-8BIT String), `Hash`, `Array``String`, `Bytearray`, `Dict`, `List``String`, `NSData`, `Dictionary`, `Array``NSString *`, `NSData *`, `NSDictionary *`, `NSArray *``String`, `Binary String`, `Associative Array`, `Array``String`, `StringBuffer`, `JSON Object` |
| extrasExtras | Metadata and/or ancillary payloads, if provided. The only currently valid payloads for extras are the [`push`](https://ably.com/docs/push/publish.md#sub-channels), [`ref`](https://ably.com/docs/channels/messages.md#interactions) and [`privileged`](https://ably.com/docs/platform/integrations/webhooks.md#skipping) objects | `JSONObject`, `JSONArray`plain C# object that can be converted to Json`String`, `[]byte``JSON Object``Hash`, `Array``Dict`, `List``Dictionary`, `Array``NSDictionary *`, `NSArray *``Associative Array`, `Array``Map`, `List` |
| idId | Unique ID assigned by Ably to this presence update | `String` |
| clientIdclient_idClientId | The client ID of the publisher of this presence update | `String` |
| connectionIdconnection_idConnectionId | The connection ID of the publisher of this presence update | `String` |
| timestampTimestamp | Timestamp when the presence update was received by Ably, as milliseconds since the epoch | `Integer``Long Integer``DateTimeOffset``Time``NSDate``Integer` |
| encodingEncoding | This will typically be empty as all presence updates received from Ably are automatically decoded client-side using this value. However, if the message encoding cannot be processed, this attribute will contain the remaining transformations not applied to the `data` payload | `String` |
### PresenceMessage constructors
#### PresenceMessage.fromEncoded
`PresenceMessage.fromEncoded(Object encodedPresMsg, ChannelOptions channelOptions?) -> PresenceMessage`
A static factory method to create a [`PresenceMessage`](https://ably.com/docs/api/realtime-sdk/types.md#presence-message) from a deserialized `PresenceMessage`-like object encoded using Ably's wire protocol.
##### Parameters
| Parameter | Description | Type |
|-----------|-------------|------|
| encodedPresMsg | A `PresenceMessage`-like deserialized object | `Object` |
| channelOptions | An optional [`ChannelOptions`](https://ably.com/docs/api/realtime-sdk/types.md#channel-options). If you have an encrypted channel, use this to allow the library to decrypt the data | `Object` |
##### Returns
A [`PresenceMessage`](https://ably.com/docs/api/realtime-sdk/types.md#presence-message) object
#### PresenceMessage.fromEncodedArray
`PresenceMessage.fromEncodedArray(Object[] encodedPresMsgs, ChannelOptions channelOptions?) -> PresenceMessage[]`
A static factory method to create an array of [`PresenceMessages`](https://ably.com/docs/api/realtime-sdk/types.md#presence-message) from an array of deserialized `PresenceMessage`-like object encoded using Ably's wire protocol.
##### Parameters
| Parameter | Description | Type |
|-----------|-------------|------|
| encodedPresMsgs | An array of `PresenceMessage`-like deserialized objects | `Array` |
| channelOptions | An optional [`ChannelOptions`](https://ably.com/docs/api/realtime-sdk/types.md#channel-options). If you have an encrypted channel, use this to allow the library to decrypt the data | `Object` |
##### Returns
An `Array` of [`PresenceMessage`](https://ably.com/docs/api/realtime-sdk/types.md#presence-message) objects
### Presence actionARTPresenceActionio.ably.lib.types.PresenceMessage.ActionAbly::Models::PresenceMessage::ACTIONAbly\Models\PresenceMessage ActionIO.Ably.PresenceAction
`Presence` `action` is a String with a value matching any of the [`Realtime Presence` states & events](https://ably.com/docs/presence-occupancy/presence.md#trigger-events).
```javascript
var PresenceActions = [
'absent', // (reserved for internal use)
'present',
'enter',
'leave',
'update'
]
```
```nodejs
var PresenceActions = [
'absent', // (reserved for internal use)
'present',
'enter',
'leave',
'update'
]
```
`io.ably.lib.types.PresenceMessage.Action` is an enum representing all the [`Realtime Presence` states & events](https://ably.com/docs/presence-occupancy/presence.md#trigger-events).
```java
public enum Action {
ABSENT, // 0 (reserved for internal use)
PRESENT, // 1
ENTER, // 2
LEAVE, // 3
UPDATE // 4
}
```
`IO.Ably.PresenceAction` is an enum representing all the [`Realtime Presence` states & events](https://ably.com/docs/presence-occupancy/presence.md#trigger-events).
```csharp
public enum Action {
Absent, // 0 (reserved for internal use)
Present, // 1
Enter, // 2
Leave, // 3
Update // 4
}
```
`PresenceAction` is an enum-like class representing all the [`Realtime Presence` states & events](https://ably.com/docs/presence-occupancy/presence.md#trigger-events).
```python
class PresenceAction(object):
ABSENT = 0 # (reserved for internal use)
PRESENT = 1
ENTER = 2
LEAVE = 3
UPDATE = 4
```
`PresenceMessage Action` is one of the class constants representing all the [`Realtime Presence` states & events](https://ably.com/docs/presence-occupancy/presence.md#trigger-events).
```php
namespace Ably\Models;
class PresenceMessages {
const ABSENT = 0; /* (reserved for internal use) */
const PRESENT = 1;
const ENTER = 2;
const LEAVE = 3;
const UPDATE = 4;
}
```
##### Example usage
```php
if ($presenceMessage->action == Ably\Models\PresenceMesage::ENTER) {
/* do something */
}
```
`Ably::Models::PresenceMessage::ACTION` is an enum-like value representing all the [`Realtime Presence` states & events](https://ably.com/docs/presence-occupancy/presence.md#trigger-events). `ACTION` can be represented interchangeably as either symbols or constants.
##### Symbol states
```ruby
:absent # => 0 (reserved for internal use)
:present # => 1
:enter # => 2
:leave # => 3
:update # => 4
```
##### Constant states
```ruby
PresenceMessage::ACTION.Absent # => 0 (internal use)
PresenceMessage::ACTION.Present # => 1
PresenceMessage::ACTION.Enter # => 2
PresenceMessage::ACTION.Leave # => 3
PresenceMessage::ACTION.Update # => 4
```
##### Example usage
```ruby
# Example with symbols
presence.on(:attached) { ... }
# Example with constants
presence.on(Ably::Models::PresenceMessage::ACTION.Enter) { ... }
# Interchangeable
Ably::Models::PresenceMessage::ACTION.Enter == :enter # => true
```
`ARTPresenceAction` is an enum representing all the [`Realtime Presence` states & events](https://ably.com/docs/presence-occupancy/presence.md#trigger-events).
```objc
typedef NS_ENUM(NSUInteger, ARTPresenceAction) {
ARTPresenceAbsent, // reserved for internal use
ARTPresencePresent,
ARTPresenceEnter,
ARTPresenceLeave,
ARTPresenceUpdate
};
```
```swift
enum ARTPresenceAction : UInt {
case Absent // reserved for internal use
case Present
case Enter
case Leave
case Update
}
```
`Presence` `action` is a String with a value matching any of the [`Realtime Presence` states & events](https://ably.com/docs/presence-occupancy/presence.md#trigger-events).
```go
const (
PresenceAbsent = 0
PresencePresent = 1
PresenceEnter = 2
PresenceLeave = 3
PresenceUpdate = 4
)
```
### PaginatedResultARTPaginatedResultio.ably.lib.types.PaginatedResultAbly::Models::PaginatedResultAbly\Models\PaginatedResultIO.Ably.PaginatedResult
A `PaginatedResult` is a type that represents a page of results for all message and presence history, stats and REST presence requests. The response from a [Ably REST API paginated query](https://ably.com/docs/api/rest-api.md#pagination) is accompanied by metadata that indicates the relative queries available to the `PaginatedResult` object.
#### PropertiesMembersAttributes
| Parameter | Description | Type |
|-----------|-------------|------|
| itemsItems | Contains the current page of results (for example an Array of [`Message`](#message) or [`PresenceMessage`](#presence-message) objects for a channel history request) | `Array``List` |
#### Methods
##### firstFirst
`first(): Promise`
`PaginatedResult first`
`PaginatedResult first()`
`PaginatedResult first()`
`Task> FirstAsync()`
`PaginatedResult first()`
`first(callback: (ARTPaginatedResult?, ARTErrorInfo?) -> Void)`
`First() (PaginatedResult, error)`
`first(callback(ErrorInfo err, PaginatedResult resultPage))`
Returns a new `PaginatedResult` for the first page of results. When using the Realtime library, the `first` method returns a [Deferrable](https://ably.com/docs/api/realtime-sdk/types.md#deferrable) and yields a [PaginatedResult](#paginated-result).The method is asynchronous and returns a Task which needs to be awaited to get the [PaginatedResult](#paginated-result).
Returns a promise. On success, the promise is fulfilled with a new `PaginatedResult` for the first page of results. On failure, the promise is rejected with an [`ErrorInfo`](https://ably.com/docs/api/realtime-sdk/types.md#error-info) object that details the reason why it was rejected.
##### hasNextHasNexthas_next?has_next
`Boolean hasNext()`
`Boolean has_next?`
`Boolean has_next()`
`Boolean HasNext()`
`HasNext() (bool)`
Returns `true` if there are more pages available by calling `next``Next` and returns `false` if this page is the last page available.
##### isLastIsLastlast?is_last
` Boolean isLast()`
`Boolean last?`
`Boolean is_last()`
`Boolean IsLast()`
`IsLast() (bool)`
Returns `true` if this page is the last page and returns `false` if there are more pages available by calling `next``Next` available.
##### nextNext
`next(): Promise`
`PaginatedResult next`
`PaginatedResult next()`
`PaginatedResult next()`
`Task> NextAsync()`
`PaginatedResult next()`
`next(callback: (ARTPaginatedResult?, ARTErrorInfo?) -> Void)`
`Next() (PaginatedResult, error)`
`next(callback(ErrorInfo err, PaginatedResult resultPage))`
Returns a new `PaginatedResult` loaded with the next page of results. If there are no further pages, then `null`a blank PaginatedResult will be returned`Null``None``nil` is returned. The method is asynchronous and return a Task which needs to be awaited to get the `PaginatedResult`When using the Realtime library, the `first` method returns a [Deferrable](https://ably.com/docs/api/realtime-sdk/types.md#deferrable) and yields a [PaginatedResult](#paginated-result).
Returns a promise. On success, the promise is fulfilled with a new `PaginatedResult` loaded with the next page of results. If there are no further pages, then `null` is returned. On failure, the promise is rejected with an [`ErrorInfo`](https://ably.com/docs/api/realtime-sdk/types.md#error-info) object that details the reason why it was rejected.
##### current
`current(): Promise<[PaginatedResult](#paginated-result>)`
Returns a promise. On success, the promise is fulfilled with a new `PaginatedResult` loaded with the current page of results. On failure, the promise is rejected with an [`ErrorInfo`](https://ably.com/docs/api/realtime-sdk/types.md#error-info) object that details the reason why it was rejected.
#### Example
```javascript
const paginatedResult = await channel.history();
console.log('Page 0 item 0:' + paginatedResult.items[0].data);
const nextPage = await paginatedResult.next();
console.log('Page 1 item 1: ' + nextPage.items[1].data);
console.log('Last page?: ' + nextPage.isLast());
```
```nodejs
const paginatedResult = await channel.history();
console.log('Page 0 item 0:' + paginatedResult.items[0].data);
const nextPage = await paginatedResult.next();
console.log('Page 1 item 1: ' + nextPage.items[1].data);
console.log('Last page?: ' + nextPage.isLast());
```
```java
PaginatedResult firstPage = channel.history();
System.out.println("Page 0 item 0:" + firstPage.items[0].data);
if (firstPage.hasNext) {
PaginatedResult nextPage = firstPage.next();
System.out.println("Page 1 item 1:" + nextPage.items[1].data);
System.out.println("More pages?:" + Strong.valueOf(nextPage.hasNext()));
};
```
```csharp
PaginatedResult firstPage = await channel.HistoryAsync(null);
Message firstMessage = firstPage.Items[0];
Console.WriteLine("Page 0 item 0: " + firstMessage.data);
if (firstPage.HasNext)
{
var nextPage = await firstPage.NextAsync();
Console.WriteLine("Page 1 item 1:" + nextPage.Items[1].data);
Console.WriteLine("More pages?: " + nextPage.HasNext());
}
```
```ruby
# When using the REST sync library
first_page = channel.history
puts "Page 0 item 0: #{first_page.items[0].data}"
if first_page.has_next?
next_page = first_page.next
puts "Page 1 item 1: #{next_page.items[1].data}"
puts "Last page?: #{next_page.is_last?}"
end
# When using the Realtime EventMachine library
channel.history do |first_page|
puts "Page 0 item 0: #{first_page.items[0].data}"
if first_page.has_next?
first_page.next do |next_page|
puts "Page 1 item 1: #{next_page.items[1].data}"
puts "Last page?: #{next_page.is_last?}"
end
end
end
```
```python
result_page = channel.history()
print 'Page 0 item 0: ' + str(result_page.items[0].data)
if result_page.has_next():
next_page = result_page.next()
print 'Page 1 item 1: ' + str(next_page.items[1].data)
print 'Last page?: ' + str(next_page.is_last())
```
```php
$firstPage = $channel.history();
echo("Page 0 item 0: " . $firstPage->items[0]->data);
if ($firstPage->hasNext()) {
$nextPage = $firstPage->next();
echo("Page 1 item 1: " . $nextPage->items[1]->data);
echo("Last page?: " . $nextPage->isLast());
}
```
```objc
[channel history:^(ARTPaginatedResult *paginatedResult, ARTErrorInfo *error) {
NSLog(@"Page 0 item 0: %@", paginatedResult.items[0].data);
[paginatedResult next:^(ARTPaginatedResult *nextPage, ARTErrorInfo *error) {
NSLog(@"Page 1 item 1: %@", nextPage.items[1].data);
NSLog(@"Last page?: %d", nextPage.isLast());
}];
}];
```
```swift
channel.history { paginatedResult, error in
guard let paginatedResult = paginatedResult else {
print("No results available")
return
}
print("Page 0 item 0: \((paginatedResult.items[0] as! ARTMessage).data)")
paginatedResult.next { nextPage, error in
guard let nextPage = nextPage else {
print("No next page available")
return
}
print("Page 1 item 1: \((nextPage.items[1] as! ARTMessage).data)")
print("Last page? \(nextPage.isLast())")
}
}
```
```go
page0, err := channel.History(nil)
fmt.Println("Page. 0 item 0: %s\n", page0.Messages[0].Data)
page1, err := page0.Next()
fmt.Println("Page. 1 item 1: %s\n", page1.Messages[1].Data)
fmt.Println("Last page? %s\n", page1.IsLast())
```
### HttpPaginatedResponse
An `HttpPaginatedResponse` is a superset of [`PaginatedResult`](https://ably.com/docs/api/rest-sdk/types.md#paginated-result), which is a type that represents a page of results plus metadata indicating the relative queries available to it. `HttpPaginatedResponse` additionally carries information about the response to an HTTP request. It is used when [making custom HTTP requests](https://ably.com/docs/api/rest-sdk.md#request).
#### PropertiesMembersAttributes
| Parameter | Description | Type |
|-----------|-------------|------|
| statusCode | The HTTP status code of the response | `Number` |
| success | Whether the HTTP status code indicates success. This is equivalent to `200 <= statusCode < 300` | `Boolean` |
| headers | The headers of the response | `Object` |
| errorCode | The error code if the `X-Ably-Errorcode` HTTP header is sent in the response | `Number``Int` |
| errorMessage | The error message if the `X-Ably-Errormessage` HTTP header is sent in the response | `String` |
| Parameter | Description | Type |
|-----------|-------------|------|
| itemsItems | Contains a page of results; for example, an array of [`Message`](#message) or [`PresenceMessage`](#presence-message) objects for a channel history request | `Array``List` |
| statusCodestatus_codeStatusCode | The HTTP status code of the response | `Number` |
| successSuccess | Whether the HTTP status code indicates success. This is equivalent to `200 <= statusCode < 300``200 <= status_code < 300``200 <= StatusCode < 300` | `Boolean` |
| headersHeaders | The headers of the response | `Object` |
| errorCodeerror_codeErrorCode | The error code if the `X-Ably-Errorcode` HTTP header is sent in the response | `Number``Int` |
| errorMessageerror_messageErrorMessage | The error message if the `X-Ably-Errormessage` HTTP header is sent in the response | `String` |
| Parameter | Description | Type |
|-----------|-------------|------|
| statusCodestatus_codeStatusCode | The HTTP status code of the response | `Number` |
| successSuccess | Whether the HTTP status code indicates success. This is equivalent to `200 <= statusCode < 300``200 <= status_code < 300``200 <= StatusCode < 300` | `Boolean` |
| headersHeaders | The headers of the response | `Object` |
| errorCodeerror_codeErrorCode | The error code if the `X-Ably-Errorcode` HTTP header is sent in the response | `Number``Int` |
| errorMessageerror_messageErrorMessage | The error message if the `X-Ably-Errormessage` HTTP header is sent in the response | `String` |
#### Methods
##### firstFirst
`first(): Promise`
`HttpPaginatedResponse first`
`HttpPaginatedResponse first()`
`HttpPaginatedResponsefirst()`
`Task> FirstAsync()`
`HttpPaginatedResponse first()`
`first(callback: (ARTHttpPaginatedResponse?, ARTErrorInfo?) -> Void)`
`First() (HttpPaginatedResponse, error)`
`first(callback(ErrorInfo err, HttpPaginatedResponse resultPage))`
Returns a new `HttpPaginatedResponse` for the first page of results. When using the Realtime library, the `first` method returns a [Deferrable](https://ably.com/docs/api/realtime-sdk/types.md#deferrable) and yields an [`HttpPaginatedResponse`](https://ably.com/docs/api/realtime-sdk/types.md#http-paginated-response).The method is asynchronous and returns a Task which needs to be awaited to get the `HttpPaginatedResponse`.
Returns a promise. On success, the promise is fulfilled with a new `HttpPaginatedResponse` for the first page of results. On failure, the promise is rejected with an [`ErrorInfo`](https://ably.com/docs/api/realtime-sdk/types.md#error-info) object that details the reason why it was rejected.
##### hasNextHasNexthas_next?has_next
`Boolean hasNext()`
`Boolean has_next?`
`Boolean has_next()`
`Boolean HasNext()`
`HasNext() (bool)`
Returns `true` if there are more pages available by calling `next``Next` and returns `false` if this page is the last page available.
##### isLastIsLastlast?is_last
`Boolean isLast()`
`Boolean last?`
`Boolean is_last()`
`Boolean IsLast()`
`IsLast() (bool)`
Returns `true` if this page is the last page and returns `false` if there are more pages available by calling `next``Next` available.
##### nextNext
`next(): Promise`
`HttpPaginatedResponse next`
`HttpPaginatedResponse next()`
`HttpPaginatedResponse next()`
`Task> NextAsync()`
`HttpPaginatedResponse next()`
`next(callback: (ARTHttpPaginatedResponse?, ARTErrorInfo?) -> Void)`
Next() (HttpPaginatedResponse, error)`
`next(callback(ErrorInfo err, HttpPaginatedResponse resultPage))`
Returns a new `HttpPaginatedResponse` loaded with the next page of results. If there are no further pages, then `null`a blank HttpPaginatedResponse will be returned`Null``None``nil` is returned. The method is asynchronous and return a Task which needs to be awaited to get the `HttpPaginatedResponse`When using the Realtime library, the `first` method returns a [Deferrable](https://ably.com/docs/api/realtime-sdk/types.md#deferrable) and yields an [HttpPaginatedResponse](https://ably.com/docs/api/realtime-sdk/types.md#http-paginated-response).
Returns a promise. On success, the promise is fulfilled with a new `HttpPaginatedResponse` loaded with the next page of results. If there are no further pages, then `null` is returned. On failure, the promise is rejected with an [`ErrorInfo`](https://ably.com/docs/api/realtime-sdk/types.md#error-info) object that details the reason why it was rejected.
##### current
`current(): Promise`
Returns a promise. On success, the promise is fulfilled with a new `HttpPaginatedResponse` loaded with the current page of results. On failure, the promise is rejected with an [`ErrorInfo`](https://ably.com/docs/api/realtime-sdk/types.md#error-info) object that details the reason why it was rejected.
##### Example
The `HttpPaginatedResponse` interface is a superset of `PaginatedResult`, see the [`PaginatedResult` example](https://ably.com/docs/api/rest-sdk/types.md#paginated-result-example)
### io.ably.lib.types.Param
`Param` is a type encapsulating a key/value pair. This type is used frequently in method parameters allowing key/value pairs to be used more flexible, see [`Channel#history`](https://ably.com/docs/api/realtime-sdk/history.md#channel-history) for an example.
Please note that `key` and `value` attributes are always strings. If an `Integer` or other value type is expected, then you must coerce that type into a `String`.
#### Members
| Parameter | Description | Type |
|-----------|-------------|------|
| key | The key value | `String` |
| value | The value associated with the `key` | `String` |
### TokenDetailsARTTokenDetialsio.ably.lib.types.TokenDetailsAbly::Models::TokenDetailsAbly\Models\TokenDetailsIO.Ably.TokenDetails
`TokenDetails` is a type providing details of Ably Token string and its associated metadata.
#### PropertiesMembersAttributes
| Parameter | Description | Type |
|-----------|-------------|------|
| tokenToken | The [Ably Token](https://ably.com/docs/api/realtime-sdk/authentication.md#token-details) itself. A typical [Ably Token](https://ably.com/docs/api/realtime-sdk/authentication.md#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](https://ably.com/docs/api/realtime-sdk/authentication.md#token-details). The capability is a a JSON stringified canonicalized representation of the resource paths and associated operations. [Read more about authentication and capabilities](https://ably.com/docs/auth/capabilities.md) | `String``Capability` |
| clientIdclient_idClientId | The client ID, if any, bound to this [Ably Token](https://ably.com/docs/api/realtime-sdk/authentication.md#token-details). If a client ID is included, then the [Ably Token](https://ably.com/docs/api/realtime-sdk/authentication.md#token-details) authenticates its bearer as that client ID, and the [Ably Token](https://ably.com/docs/api/realtime-sdk/authentication.md#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](https://ably.com/docs/auth/identified-clients.md) | `String` |
#### Methods
| Method | Description | Returns |
|--------|-------------|---------|
| expired? | True when the token has expired | `Boolean` |
#### Methods
| Method | Description | Returns |
|--------|-------------|---------|
| is_expired() | True when the token has expired | `Boolean` |
#### Methods
| Method | Description | Returns |
|--------|-------------|---------|
| IsValidToken() | True if the token has not expired | `Boolean` |
### TokenDetails constructors
#### TokenDetails.fromJsonTokenDetails.from_jsonTokenDetails.fromMap
`TokenDetails.fromJson(String json) -> TokenDetails`
`TokenDetails.from_json(String json) -> TokenDetails`
`TokenDetails.fromMap(Map map)`
A static factory methodnamed constructor to create a [`TokenDetails`](https://ably.com/docs/api/realtime-sdk/types.md#token-details) from a deserialized `TokenDetails`-like object or a JSON stringified `TokenDetails`map. This method is provided to minimize bugs as a result of differing types by platform for fields such as `timestamp` or `ttl`. For example, in Ruby `ttl` in the `TokenDetails` object is exposed in seconds as that is idiomatic for the language, yet when serialized to JSON using `to_json` it is automatically converted to the Ably standard which is milliseconds. By using the `fromJson``fromMap` method when constructing a `TokenDetails`, Ably ensures that all fields are consistently serialized and deserialized across platforms.
##### Parameters
| Parameter | Description | Type |
|-----------|-------------|------|
| json | A `TokenDetails`-like deserialized object or JSON stringified `TokenDetails`. | `Object`, `String` |
| Parameter | Description | Type |
|-----------|-------------|------|
| map | A `TokenDetails`-like deserialized map. | `Map` |
##### Returns
A [`TokenDetails`](https://ably.com/docs/api/realtime-sdk/types.md#token-details) object
### TokenRequestAbly\Models\TokenRequestARTTokenRequestio.ably.lib.types.TokenRequestAbly::Models::TokenRequestIO.Ably.TokenRequest
`TokenRequest` is a type containing parameters for an Ably `TokenRequest`. [Ably Tokens](https://ably.com/docs/api/realtime-sdk/authentication.md#token-details) are requested using [Auth#requestToken](https://ably.com/docs/api/rest-sdk/authentication.md#request-token)[Auth#request_token](https://ably.com/docs/api/rest-sdk/authentication.md#request-token)
#### PropertiesMembersAttributes
| Parameter | Description | Type |
|-----------|-------------|------|
| 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](https://ably.com/docs/api/realtime-sdk/authentication.md#token-details) in millisecondsin secondsas a `TimeSpan`. If the Ably `TokenRequest` is successful, the TTL of the returned [Ably Token](https://ably.com/docs/api/realtime-sdk/authentication.md#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](https://ably.com/docs/api/realtime-sdk/authentication.md#token-details). If the Ably `TokenRequest` is successful, the capability of the returned [Ably Token](https://ably.com/docs/api/realtime-sdk/authentication.md#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](https://ably.com/docs/auth.md) | `String` |
| clientIdclient_idClientId | The client ID to associate with the requested [Ably Token](https://ably.com/docs/api/realtime-sdk/authentication.md#token-details). When provided, the [Ably Token](https://ably.com/docs/api/realtime-sdk/authentication.md#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` |
### TokenRequest constructors
#### TokenRequest.fromJsonTokenRequest.from_jsonTokenRequest.fromMap
`TokenRequest.fromJson(String json) -> TokenRequest`
`TokenRequest.from_json(String json) -> TokenRequest`
`TokenRequest.fromMap(Map map)`
A static factory methodnamed constructor to create a [`TokenRequest`](https://ably.com/docs/api/realtime-sdk/types.md#token-request) from a deserialized `TokenRequest`-like object or a JSON stringified `TokenRequest`map. This method is provided to minimize bugs as a result of differing types by platform for fields such as `timestamp` or `ttl`. For example, in Ruby `ttl` in the `TokenRequest` object is exposed in seconds as that is idiomatic for the language, yet when serialized to JSON using `to_json` it is automatically converted to the Ably standard which is milliseconds. By using the `fromJson``fromMap` method when constructing a `TokenRequest`, Ably ensures that all fields are consistently serialized and deserialized across platforms.
##### Parameters
| Parameter | Description | Type |
|-----------|-------------|------|
| json | A `TokenRequest`-like deserialized object or JSON stringified `TokenRequest`. | `Object`, `String` |
| Parameter | Description | Type |
|-----------|-------------|------|
| map | A `TokenRequest`-like deserialized map. | `Map` |
##### Returns
A [`TokenRequest`](https://ably.com/docs/api/realtime-sdk/types.md#token-request) object
### Stats objectARTStatsio.ably.lib.types.StatsAbly::Models::StatsAbly\Models\StatsIO.Ably.Stats
A `Stats` object represents an application's statistics for the specified interval and time period. Ably aggregates statistics globally for all accounts and applications, and makes these available both through our [statistics API](https://ably.com/docs/metadata-stats/stats.md) as well as your [application dashboard](https://ably.com/dashboard).
Please note that most attributes of the `Stats` type below contain references to further stats types. This documentation is not exhaustive for all stats types, and as such, links to the stats types below will take you to the [Ruby library stats documentation](https://www.rubydoc.info/gems/ably/Ably/Models/Stats) which contains exhaustive stats documentation. Ruby and Python however uses `under_score` case instead of the default `camelCase` in most languages, so please bear that in mind.
##### PropertiesMembersAttributesKeyword arguments
| Parameter | Description | Type |
|-----------|-------------|------|
| unitunitunitunit | The length of the interval that this statistic covers, such as `:minute`, `:hour`, `:day`, `:month``Minute`, `Hour`, `Day`, `Month``StatGranularityDay`, `StatGranularityMonth``'minute'`, `'hour'`, `'day'`, `'month'`. | [`Stats::GRANULARITY`](https://www.rubydoc.info/gems/ably/Ably/Models/Stats#GRANULARITY-constant)[`StatsIntervalGranularity`](https://ably.com/docs/api/realtime-sdk/types.md#stats-granularity) enum`ARTStatsGranularity``String` |
| interval_granularityintervalGranularity | Deprecated alias for `unit`; scheduled to be removed in version 2.x client library versions. | [`Stats::GRANULARITY`](https://www.rubydoc.info/gems/ably/Ably/Models/Stats#GRANULARITY-constant)[`StatsIntervalGranularity`](https://ably.com/docs/api/realtime-sdk/types.md#stats-granularity) enum`ARTStatsGranularity``String` |
| intervalIdinterval_idIntervalId | The UTC time at which the time period covered by this `Stats` object starts. For example, an interval ID value of "2018-03-01:10" in a `Stats` object whose `unit` is `day` would indicate that the period covered is "2018-03-01:10 .. 2018-03-01:11". All `Stats` objects, except those whose `unit` is `minute`, have an interval ID with resolution of one hour and the time period covered will always begin and end at a UTC hour boundary. For this reason it is not possible to infer the `unit` by looking at the resolution of the `intervalId`. `Stats` objects covering an individual minute will have an interval ID indicating that time; for example "2018-03-01:10:02". | `String` |
| interval_timeIntervalTime | A `Time``DateTime``DateTimeOffset` object representing the parsed `intervalId``interval_id``IntervalId` (the UTC time at which the time period covered by this `Stats` object starts) | `Time``DateTime``DateTimeOffset` |
| allAll | Aggregate count of both `inbound` and `outbound` message stats | [`MessageTypes`](https://www.rubydoc.info/gems/ably/Ably/Models/Stats/MessageTypes) |
| apiRequestsapi_requestsApiRequests | Breakdown of API requests received via the Ably REST API | [`RequestCount`](https://www.rubydoc.info/gems/ably/Ably/Models/Stats/RequestCount) |
| channelsChannels | Breakdown of channel related stats such as min, mean and peak channels | [`ResourceCount`](https://www.rubydoc.info/gems/ably/Ably/Models/Stats/ResourceCount) |
| connectionsConnections | Breakdown of connection related stats such as min, mean and peak connections for TLS and non-TLS connections | [`ConnectionTypes`](https://www.rubydoc.info/gems/ably/Ably/Models/Stats/ConnectionTypes) |
| inboundInbound | Statistics such as count and data for all inbound messages received over REST and Realtime connections, organized into normal channel messages or presence messages | [`MessageTraffic`](https://www.rubydoc.info/gems/ably/Ably/Models/Stats/MessageTraffic) |
| outboundOutbound | Statistics such as count and data for all outbound messages retrieved via REST history requests, received over Realtime connections, or pushed with Webhooks, organized into normal channel messages or presence messages | [`MessageTraffic`](https://www.rubydoc.info/gems/ably/Ably/Models/Stats/MessageTraffic) |
| persistedPersisted | Messages persisted and later retrieved via the [history API](https://ably.com/docs/storage-history/history.md) | [`MessageTypes`](https://www.rubydoc.info/gems/ably/Ably/Models/Stats/MessageTypes) |
| tokenRequeststoken_requestsTokenRequests | Breakdown of Ably Token requests received via the Ably REST API. | [`RequestCount`](https://www.rubydoc.info/gems/ably/Ably/Models/Stats/RequestCount) |
| pushPush | Detailed stats on push notifications, see [our Push documentation](https://ably.com/push) for more details | `PushStats` |
| Parameter | Description | Type |
|-----------|-------------|------|
| unitunitunitunit | The length of the interval that this statistic covers, such as `:minute`, `:hour`, `:day`, `:month``Minute`, `Hour`, `Day`, `Month``StatGranularityDay`, `StatGranularityMonth``'minute'`, `'hour'`, `'day'`, `'month'`. | [`Stats::GRANULARITY`](https://www.rubydoc.info/gems/ably/Ably/Models/Stats#GRANULARITY-constant)[`StatsIntervalGranularity`](https://ably.com/docs/api/realtime-sdk/types.md#stats-granularity) enum`ARTStatsGranularity``String` |
| interval_granularityintervalGranularity | Deprecated alias for `unit`; scheduled to be removed in version 2.x client library versions. | [`Stats::GRANULARITY`](https://www.rubydoc.info/gems/ably/Ably/Models/Stats#GRANULARITY-constant)[`StatsIntervalGranularity`](https://ably.com/docs/api/realtime-sdk/types.md#stats-granularity) enum`ARTStatsGranularity``String` |
| intervalIdinterval_idIntervalId | The UTC time at which the time period covered by this `Stats` object starts. For example, an interval ID value of "2018-03-01:10" in a `Stats` object whose `unit` is `day` would indicate that the period covered is "2018-03-01:10 .. 2018-03-01:11". All `Stats` objects, except those whose `unit` is `minute`, have an interval ID with resolution of one hour and the time period covered will always begin and end at a UTC hour boundary. For this reason it is not possible to infer the `unit` by looking at the resolution of the `intervalId`. `Stats` objects covering an individual minute will have an interval ID indicating that time; for example "2018-03-01:10:02". | `String` |
| allAll | Aggregate count of both `inbound` and `outbound` message stats | [`MessageTypes`](https://www.rubydoc.info/gems/ably/Ably/Models/Stats/MessageTypes) |
| apiRequestsapi_requestsApiRequests | Breakdown of API requests received via the Ably REST API | [`RequestCount`](https://www.rubydoc.info/gems/ably/Ably/Models/Stats/RequestCount) |
| channelsChannels | Breakdown of channel related stats such as min, mean and peak channels | [`ResourceCount`](https://www.rubydoc.info/gems/ably/Ably/Models/Stats/ResourceCount) |
| connectionsConnections | Breakdown of connection related stats such as min, mean and peak connections for TLS and non-TLS connections | [`ConnectionTypes`](https://www.rubydoc.info/gems/ably/Ably/Models/Stats/ConnectionTypes) |
| inboundInbound | Statistics such as count and data for all inbound messages received over REST and Realtime connections, organized into normal channel messages or presence messages | [`MessageTraffic`](https://www.rubydoc.info/gems/ably/Ably/Models/Stats/MessageTraffic) |
| outboundOutbound | Statistics such as count and data for all outbound messages retrieved via REST history requests, received over Realtime connections, or pushed with Webhooks, organized into normal channel messages or presence messages | [`MessageTraffic`](https://www.rubydoc.info/gems/ably/Ably/Models/Stats/MessageTraffic) |
| persistedPersisted | Messages persisted and later retrieved via the [history API](https://ably.com/docs/storage-history/history.md) | [`MessageTypes`](https://www.rubydoc.info/gems/ably/Ably/Models/Stats/MessageTypes) |
| tokenRequeststoken_requestsTokenRequests | Breakdown of Ably Token requests received via the Ably REST API. | [`RequestCount`](https://www.rubydoc.info/gems/ably/Ably/Models/Stats/RequestCount) |
| pushPush | Detailed stats on push notifications, see [our Push documentation](https://ably.com/push) for more details | `PushStats` |
| Parameter | Description | Type |
|-----------|-------------|------|
| unitunitunitunit | The length of the interval that this statistic covers, such as `:minute`, `:hour`, `:day`, `:month``Minute`, `Hour`, `Day`, `Month``StatGranularityDay`, `StatGranularityMonth``'minute'`, `'hour'`, `'day'`, `'month'`. | [`Stats::GRANULARITY`](https://www.rubydoc.info/gems/ably/Ably/Models/Stats#GRANULARITY-constant)[`StatsIntervalGranularity`](https://ably.com/docs/api/realtime-sdk/types.md#stats-granularity) enum`ARTStatsGranularity``String` |
| intervalIdinterval_idIntervalId | The UTC time at which the time period covered by this `Stats` object starts. For example, an interval ID value of "2018-03-01:10" in a `Stats` object whose `unit` is `day` would indicate that the period covered is "2018-03-01:10 .. 2018-03-01:11". All `Stats` objects, except those whose `unit` is `minute`, have an interval ID with resolution of one hour and the time period covered will always begin and end at a UTC hour boundary. For this reason it is not possible to infer the `unit` by looking at the resolution of the `intervalId`. `Stats` objects covering an individual minute will have an interval ID indicating that time; for example "2018-03-01:10:02". | `String` |
| allAll | Aggregate count of both `inbound` and `outbound` message stats | [`MessageTypes`](https://www.rubydoc.info/gems/ably/Ably/Models/Stats/MessageTypes) |
| apiRequestsapi_requestsApiRequests | Breakdown of API requests received via the Ably REST API | [`RequestCount`](https://www.rubydoc.info/gems/ably/Ably/Models/Stats/RequestCount) |
| channelsChannels | Breakdown of channel related stats such as min, mean and peak channels | [`ResourceCount`](https://www.rubydoc.info/gems/ably/Ably/Models/Stats/ResourceCount) |
| connectionsConnections | Breakdown of connection related stats such as min, mean and peak connections for TLS and non-TLS connections | [`ConnectionTypes`](https://www.rubydoc.info/gems/ably/Ably/Models/Stats/ConnectionTypes) |
| inboundInbound | Statistics such as count and data for all inbound messages received over REST and Realtime connections, organized into normal channel messages or presence messages | [`MessageTraffic`](https://www.rubydoc.info/gems/ably/Ably/Models/Stats/MessageTraffic) |
| outboundOutbound | Statistics such as count and data for all outbound messages retrieved via REST history requests, received over Realtime connections, or pushed with Webhooks, organized into normal channel messages or presence messages | [`MessageTraffic`](https://www.rubydoc.info/gems/ably/Ably/Models/Stats/MessageTraffic) |
| persistedPersisted | Messages persisted and later retrieved via the [history API](https://ably.com/docs/storage-history/history.md) | [`MessageTypes`](https://www.rubydoc.info/gems/ably/Ably/Models/Stats/MessageTypes) |
| tokenRequeststoken_requestsTokenRequests | Breakdown of Ably Token requests received via the Ably REST API. | [`RequestCount`](https://www.rubydoc.info/gems/ably/Ably/Models/Stats/RequestCount) |
| pushPush | Detailed stats on push notifications, see [our Push documentation](https://ably.com/push) for more details | `PushStats` |
| Parameter | Description | Type |
|-----------|-------------|------|
| appId | The ID of the Ably application the statistics relate to. | `String` |
| entries | The statistics for the requested time interval and time period. The `schema` property provides further information | `Partial>` |
| inProgress | Optional. For entries that are still in progress, such as the current month, the last sub-interval included in the stats entry. In the format `yyyy-mm-dd:hh:mm:ss` | `String` |
| intervalId | The UTC time period that the stats coverage begins at. If `unit` was requested as `minute` this will be in the format `YYYY-mm-dd:HH:MM`, if `hour` it will be `YYYY-mm-dd:HH`, if `day` it will be `YYYY-mm-dd:00` and if `month` it will be `YYYY-mm-01:00` | `String` |
| schema | The URL of a JSON schema describing the structure of the `Stats` object | `String` |
### StatsIntervalGranularityARTStatsGranularity
`StatsIntervalGranularity` is an enum specifying the granularity of a [`Stats interval`](https://ably.com/docs/api/rest-sdk/statistics.md#stats-type).
```javascript
const StatsIntervalGranularity = [
'minute',
'hour',
'day',
'month'
]
```
```nodejs
const StatsIntervalGranularity = [
'minute',
'hour',
'day',
'month'
]
```
`ARTStatsGranularity` is an enum specifying the granularity of a [`ARTStats interval`](https://ably.com/docs/api/rest-sdk/statistics.md#stats-type).
```objc
typedef NS_ENUM(NSUInteger, ARTStatsGranularity) {
ARTStatsGranularityMinute,
ARTStatsGranularityHour,
ARTStatsGranularityDay,
ARTStatsGranularityMonth
};
```
```swift
enum ARTStatsGranularity : UInt {
case Minute
case Hour
case Day
case Month
}
```
`StatsIntervalGranularity` is an enum specifying the granularity of a [`Stats interval`](https://ably.com/docs/api/rest-sdk/statistics.md#stats-type).
```csharp
public enum StatsIntervalGranularity
{
Minute,
Hour,
Day,
Month
}
```
### IO.Ably.PaginatedRequestParams
`HistoryRequestParams` is a type that encapsulates the parameters for a history queries. For example usage see [`Channel#History`](https://ably.com/docs/api/realtime-sdk/history.md#channel-history).
##### Members
| Parameter | Description | Type |
|-----------|-------------|------|
| Start | The start of the queried interval. The default is null. | `DateTimeOffset` |
| End | The end of the queried interval. The default is null. | `DateTimeOffset` |
| Limit | Limits the number of items returned by history or stats. By default it is null. | `Integer` |
| Direction | Enum which is either `Forwards` or `Backwards`. The default is `Backwards`. | `Direction` enum |
| ExtraParameters | Optionally any extra query parameters that may be passed to the query. This is mainly used internally by the library to manage paging. | `Dictionary` |
### BatchPublishSpec
A `BatchPublishSpec` describes the messages that should be published by a batch publish operation, and the channels to which they should be published.
#### Properties
| Parameter | Description | Type |
|-----------|-------------|------|
| channels | The names of the channels to publish the `messages` to | `String[]` |
| messages | An array of [`Message`](https://ably.com/docs/api/realtime-sdk/types.md#message) objects | [`Message[]`](/docs/api/realtime-sdk/types#message) |
### BatchResult
A `BatchResult` contains information about the results of a batch operation.
#### Properties
| Parameter | Description | Type |
|-----------|-------------|------|
| successCount | The number of successful operations in the request | `Number` |
| failureCount | The number of unsuccessful operations in the request | `Number` |
| messages | An array of results for the batch operation (for example, an array of [`BatchPublishSuccessResult`](https://ably.com/docs/api/realtime-sdk/types.md#batch-publish-success-result) or [`BatchPublishFailureResult`](https://ably.com/docs/api/realtime-sdk/types.md#batch-publish-failure-result) for a channel batch publish request) | `Object[]` |
### BatchPublishSuccessResult
A `BatchPublishSuccessResult` contains information about the result of successful publishes to a channel requested by a single [`BatchPublishSpec`](https://ably.com/docs/api/realtime-sdk/types.md#batch-publish-spec).
#### Properties
| Parameter | Description | Type |
|-----------|-------------|------|
| channel | The name of the channel the message(s) was published to | `String` |
| messageId | A unique ID prefixed to the `Message.id` of each published message | `String` |
### BatchPublishFailureResult
A `BatchPublishFailureResult` contains information about the result of unsuccessful publishes to a channel requested by a single [`BatchPublishSpec`](https://ably.com/docs/api/realtime-sdk/types.md#batch-publish-spec).
#### Properties
| Parameter | Description | Type |
|-----------|-------------|------|
| channel | The name of the channel the message(s) failed to be published to | `String` |
| error | Describes the reason for which the message(s) failed to publish to the channel as an [`ErrorInfo`](https://ably.com/docs/api/realtime-sdk/types.md#error-info) object | [`ErrorInfo`](https://ably.com/docs/api/realtime-sdk/types.md#error-info) |
### BatchPresenceSuccessResult
A `BatchPresenceSuccessResult` contains information about the result of a successful batch presence request for a single channel.
#### Properties
| Parameter | Description | Type |
|-----------|-------------|------|
| channel | The channel name the presence state was retrieved for | `String` |
| presence | An array of [`PresenceMessage`](https://ably.com/docs/api/realtime-sdk/types.md#presence-message) describing members present on the channel | [`PresenceMessage[]`](/docs/api/realtime-sdk/types#presence-message) |
### BatchPresenceFailureResult
A BatchPresenceFailureResult contains information about the result of an unsuccessful batch presence request for a single channel.
#### Properties
| Parameter | Description | Type |
|-----------|-------------|------|
| channel | The channel name the presence state failed to be retrieved for | `String` |
| error | Describes the reason for which presence state could not be retrieved for the channel as an [`ErrorInfo`](https://ably.com/docs/api/realtime-sdk/types.md#error-info) object | [`ErrorInfo`](https://ably.com/docs/api/realtime-sdk/types.md#error-info) |
### TokenRevocationSuccessResult
A `TokenRevocationSuccessResult` contains information about the result of a successful token revocation request for a single target specifier.
#### Properties
| Parameter | Description | Type |
|-----------|-------------|------|
| target | The target specifier | `String` |
| appliesAt | The time at which the token revocation will take effect, as a Unix timestamp in milliseconds | `Number` |
| issuedBefore | A Unix timestamp in milliseconds. Only tokens issued earlier than this time will be revoked | `Number` |
### TokenRevocationFailureResult
A `TokenRevocationFailureResult` contains information about the result of an unsuccessful token revocation request for a single target specifier.
#### Properties
| Parameter | Description | Type |
|-----------|-------------|------|
| target | The target specifier | `String` |
| error | Describes the reason for which token revocation failed for the given `target` as an [`ErrorInfo`](https://ably.com/docs/api/realtime-sdk/types.md#error-info) object | [`ErrorInfo`](https://ably.com/docs/api/realtime-sdk/types.md#error-info) |
## REST Other types
### AuthOptions ObjectARTAuthOptionsAuthOptions HashAuthOptions Arrayio.ably.lib.rest.Auth.AuthOptionsIO.Ably.AuthOptions
`AuthOptions` is a plain JavaScript object and is used when making [authentication](https://ably.com/docs/auth.md) 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](https://ably.com/docs/auth.md) 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](https://ably.com/docs/auth.md) 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](https://ably.com/docs/auth.md) 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](https://ably.com/docs/auth.md) requests. These options will supplement or override the corresponding options given when the library was instantiated.
#### PropertiesMembersAttributes
| 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`](https://ably.com/docs/api/realtime-sdk/types.md#token-request); a [`TokenDetails`](https://ably.com/docs/api/realtime-sdk/types.md#token-details) (in JSON format); an [Ably JWT](https://ably.com/docs/api/realtime-sdk/authentication.md#ably-jwt). See [our authentication documentation](https://ably.com/docs/auth.md) 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`](https://ably.com/docs/api/realtime-sdk/types.md#token-request); a [`TokenDetails`](https://ably.com/docs/api/realtime-sdk/types.md#token-details) (in JSON format); an [Ably JWT](https://ably.com/docs/api/realtime-sdk/authentication.md#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`](https://ably.com/docs/api/realtime-sdk/types.md#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](https://ably.com/docs/auth/token.md) | `TokenDetails` |
| keyKey:keykey | Optionally the [API key](https://ably.com/docs/auth.md#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](https://ably.com/docs/auth/token.md) instead of relying on a locally-available time of day. Knowing the time accurately is needed to create valid signed Ably [TokenRequests](https://ably.com/docs/auth/token.md), 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`](https://ably.com/docs/api/realtime-sdk/types.md#token-details) object, a [`TokenRequest`](https://ably.com/docs/api/realtime-sdk/types.md#token-request) object, or token string (obtained from the `token``Token` property of a [`TokenDetails`](https://ably.com/docs/api/realtime-sdk/types.md#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](https://ably.com/docs/auth/token.md#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](https://ably.com/docs/auth/token.md) | `String`, `TokenDetails` or `TokenRequest` |
### ClientOptions ObjectARTClientOptionsClientOptions HashClientOptions Arrayio.ably.types.ClientOptionsIO.Ably.ClientOptions
`ClientOptions` is a plain JavaScript object and is used in the `Ably.Rest` constructor's `options` argument. The following attributes can be defined on the object:
`ClientOptions` is a Hash object and is used in the `Ably::Rest` constructor's `options` argument. The following key symbol values can be added to the Hash:
`ClientOptions` is a associative array and is used in the `Ably\AblyRest` constructor's `options` argument. The following named keys and values can be added to the associative array:
`ART``ClientOptions` is used in the `AblyRest` constructor's `options` argument.
`ably.ClientOptions` is used in the `ably.Rest` constructor's `options` named argument
#### PropertiesMembersAttributesKeywords arguments
| 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](https://ably.com/docs/auth/basic.md) | `String` |
| token | An authenticated token. This can either be a [`TokenDetails`](https://ably.com/docs/api/realtime-sdk/types.md#token-details) object, a [`TokenRequest`](https://ably.com/docs/api/realtime-sdk/types.md#token-request) object, or token string (obtained from the `token` property of a [`TokenDetails`](https://ably.com/docs/api/realtime-sdk/types.md#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](https://ably.com/docs/auth/token.md#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](https://ably.com/docs/auth/token.md) | `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`](https://ably.com/docs/api/realtime-sdk/types.md#token-request); a [`TokenDetails`](https://ably.com/docs/api/realtime-sdk/types.md#token-details) (in JSON format); an [Ably JWT](https://ably.com/docs/api/realtime-sdk/authentication.md#ably-jwt). See [our authentication documentation](https://ably.com/docs/auth.md) 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`](https://ably.com/docs/api/realtime-sdk/types.md#token-request); a [`TokenDetails`](https://ably.com/docs/api/realtime-sdk/types.md#token-details) (in JSON format); an [Ably JWT](https://ably.com/docs/api/realtime-sdk/authentication.md#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`](https://ably.com/docs/api/realtime-sdk/types.md#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](https://ably.com/docs/auth/token.md) | `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](https://ably.com/docs/auth/identified-clients.md) | `String` |
| useTokenAuth | When true, forces [Token authentication](https://ably.com/docs/auth/token.md) to be used by the library. Please note that if a `clientId` is not specified in the [`ClientOptions`](https://ably.com/docs/api/realtime-sdk/types.md#client-options) or [`TokenParams`](https://ably.com/docs/api/realtime-sdk/types.md#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](https://ably.com/docs/platform/account/enterprise-customization.md) 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](https://ably.com/docs/platform/account/enterprise-customization.md) 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`](https://ably.com/docs/connect.md#heartbeats) and [`remainPresentFor`](https://ably.com/docs/presence-occupancy/presence.md#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` |
| 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](https://ably.com/docs/auth/token.md) instead of relying on a locally-available time of day. Knowing the time accurately is needed to create valid signed Ably [TokenRequests](https://ably.com/docs/api/rest-sdk/authentication.md#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](https://ably.com/docs/api/rest-sdk/types.md#token-params) object is provided, it will override the client library defaults when issuing new [Ably Tokens](https://ably.com/docs/api/realtime-sdk/authentication.md#token-details) or [Ably TokenRequests](https://ably.com/docs/api/rest-sdk/authentication.md#token-request) | [`TokenParams`](https://ably.com/docs/api/rest-sdk/types.md#token-params) |
| 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](https://ably.com/docs/auth/basic.md) | `String` |
| token | An authenticated token. This can either be a [`TokenDetails`](https://ably.com/docs/api/realtime-sdk/types.md#token-details) object, a [`TokenRequest`](https://ably.com/docs/api/realtime-sdk/types.md#token-request) object, or token string (obtained from the `token` property of a [`TokenDetails`](https://ably.com/docs/api/realtime-sdk/types.md#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](https://ably.com/docs/auth/token.md#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](https://ably.com/docs/auth/token.md) | `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`](https://ably.com/docs/api/realtime-sdk/types.md#token-request); a [`TokenDetails`](https://ably.com/docs/api/realtime-sdk/types.md#token-details) (in JSON format); an [Ably JWT](https://ably.com/docs/api/realtime-sdk/authentication.md#ably-jwt). See [our authentication documentation](https://ably.com/docs/auth.md) 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`](https://ably.com/docs/api/realtime-sdk/types.md#token-request); a [`TokenDetails`](https://ably.com/docs/api/realtime-sdk/types.md#token-details) (in JSON format); an [Ably JWT](https://ably.com/docs/api/realtime-sdk/authentication.md#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`](https://ably.com/docs/api/realtime-sdk/types.md#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](https://ably.com/docs/auth/token.md) | `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](https://ably.com/docs/auth/identified-clients.md) | `String` |
| useTokenAuth | When true, forces [Token authentication](https://ably.com/docs/auth/token.md) to be used by the library. Please note that if a `clientId` is not specified in the [`ClientOptions`](https://ably.com/docs/api/realtime-sdk/types.md#client-options) or [`TokenParams`](https://ably.com/docs/api/realtime-sdk/types.md#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](https://ably.com/docs/platform/account/enterprise-customization.md) 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](https://ably.com/docs/platform/account/enterprise-customization.md) 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`](https://ably.com/docs/connect.md#heartbeats) and [`remainPresentFor`](https://ably.com/docs/presence-occupancy/presence.md#unstable-connections) | `Param []` |
| 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](https://ably.com/docs/auth/token.md) instead of relying on a locally-available time of day. Knowing the time accurately is needed to create valid signed Ably [TokenRequests](https://ably.com/docs/api/rest-sdk/authentication.md#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](https://ably.com/docs/api/rest-sdk/types.md#token-params) object is provided, it will override the client library defaults when issuing new [Ably Tokens](https://ably.com/docs/api/realtime-sdk/authentication.md#token-details) or [Ably TokenRequests](https://ably.com/docs/api/rest-sdk/authentication.md#token-request) | [`TokenParams`](https://ably.com/docs/api/rest-sdk/types.md#token-params) |
| 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](https://ably.com/docs/auth/basic.md) | `String` |
| Token | An authenticated token. This can either be a [`TokenDetails`](https://ably.com/docs/api/realtime-sdk/types.md#token-details) object, a [`TokenRequest`](https://ably.com/docs/api/realtime-sdk/types.md#token-request) object, or token string (obtained from the `Token` property of a [`TokenDetails`](https://ably.com/docs/api/realtime-sdk/types.md#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](https://ably.com/docs/auth/token.md#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](https://ably.com/docs/auth/token.md) | `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`](https://ably.com/docs/api/realtime-sdk/types.md#token-request); a [`TokenDetails`](https://ably.com/docs/api/realtime-sdk/types.md#token-details) (in JSON format); an [Ably JWT](https://ably.com/docs/api/realtime-sdk/authentication.md#ably-jwt). See [our authentication documentation](https://ably.com/docs/auth.md) 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`](https://ably.com/docs/api/realtime-sdk/types.md#token-request); a [`TokenDetails`](https://ably.com/docs/api/realtime-sdk/types.md#token-details) (in JSON format); an [Ably JWT](https://ably.com/docs/api/realtime-sdk/authentication.md#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`](https://ably.com/docs/api/realtime-sdk/types.md#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](https://ably.com/docs/auth/token.md) | `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](https://ably.com/docs/auth/identified-clients.md) | `String` |
| UseTokenAuth | When true, forces [Token authentication](https://ably.com/docs/auth/token.md) to be used by the library. Please note that if a `clientId` is not specified in the [`ClientOptions`](https://ably.com/docs/api/realtime-sdk/types.md#client-options) or [`TokenParams`](https://ably.com/docs/api/realtime-sdk/types.md#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](https://ably.com/docs/platform/account/enterprise-customization.md) 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](https://ably.com/docs/platform/account/enterprise-customization.md) 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`](https://ably.com/docs/connect.md#heartbeats) and [`remainPresentFor`](https://ably.com/docs/presence-occupancy/presence.md#unstable-connections) | `Dictionary` |
| 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](https://ably.com/docs/auth/token.md) instead of relying on a locally-available time of day. Knowing the time accurately is needed to create valid signed Ably [TokenRequests](https://ably.com/docs/api/rest-sdk/authentication.md#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](https://ably.com/docs/api/rest-sdk/types.md#token-params) object is provided, it will override the client library defaults when issuing new [Ably Tokens](https://ably.com/docs/api/realtime-sdk/authentication.md#token-details) or [Ably TokenRequests](https://ably.com/docs/api/rest-sdk/authentication.md#token-request) | [`TokenParams`](https://ably.com/docs/api/rest-sdk/types.md#token-params) |
| 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](https://ably.com/docs/auth/basic.md) | `String` |
| Token | An authenticated token. This can either be a [`TokenDetails`](https://ably.com/docs/api/realtime-sdk/types.md#token-details) object, a [`TokenRequest`](https://ably.com/docs/api/realtime-sdk/types.md#token-request) object, or token string (obtained from the `Token` property of a [`TokenDetails`](https://ably.com/docs/api/realtime-sdk/types.md#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](https://ably.com/docs/auth/token.md#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](https://ably.com/docs/auth/token.md) | `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`](https://ably.com/docs/api/realtime-sdk/types.md#token-request); a [`TokenDetails`](https://ably.com/docs/api/realtime-sdk/types.md#token-details) (in JSON format); an [Ably JWT](https://ably.com/docs/api/realtime-sdk/authentication.md#ably-jwt). See [our authentication documentation](https://ably.com/docs/auth.md) 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`](https://ably.com/docs/api/realtime-sdk/types.md#token-request); a [`TokenDetails`](https://ably.com/docs/api/realtime-sdk/types.md#token-details) (in JSON format); an [Ably JWT](https://ably.com/docs/api/realtime-sdk/authentication.md#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`](https://ably.com/docs/api/realtime-sdk/types.md#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](https://ably.com/docs/auth/token.md) | `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](https://ably.com/docs/auth/identified-clients.md) | `String` |
| UseTokenAuth | When true, forces [Token authentication](https://ably.com/docs/auth/token.md) to be used by the library. Please note that if a `clientId` is not specified in the [`ClientOptions`](https://ably.com/docs/api/realtime-sdk/types.md#client-options) or [`TokenParams`](https://ably.com/docs/api/realtime-sdk/types.md#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](https://ably.com/docs/platform/account/enterprise-customization.md) 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](https://ably.com/docs/platform/account/enterprise-customization.md) 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`](https://ably.com/docs/connect.md#heartbeats) and [`remainPresentFor`](https://ably.com/docs/presence-occupancy/presence.md#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](https://ably.com/docs/auth/token.md) instead of relying on a locally-available time of day. Knowing the time accurately is needed to create valid signed Ably [TokenRequests](https://ably.com/docs/api/rest-sdk/authentication.md#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](https://ably.com/docs/api/rest-sdk/types.md#token-params) object is provided, it will override the client library defaults when issuing new [Ably Tokens](https://ably.com/docs/api/realtime-sdk/authentication.md#token-details) or [Ably TokenRequests](https://ably.com/docs/api/rest-sdk/authentication.md#token-request) | [`TokenParams`](https://ably.com/docs/api/rest-sdk/types.md#token-params) |
| 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](https://ably.com/docs/auth/basic.md) | `String` |
| token | An authenticated token. This can either be a [`TokenDetails`](https://ably.com/docs/api/realtime-sdk/types.md#token-details) object, a [`TokenRequest`](https://ably.com/docs/api/realtime-sdk/types.md#token-request) object, or token string (obtained from the `token` property of a [`TokenDetails`](https://ably.com/docs/api/realtime-sdk/types.md#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](https://ably.com/docs/auth/token.md#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](https://ably.com/docs/auth/token.md) | `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`](https://ably.com/docs/api/realtime-sdk/types.md#token-request); a [`TokenDetails`](https://ably.com/docs/api/realtime-sdk/types.md#token-details) (in JSON format); an [Ably JWT](https://ably.com/docs/api/realtime-sdk/authentication.md#ably-jwt). See [our authentication documentation](https://ably.com/docs/auth.md) 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`](https://ably.com/docs/api/realtime-sdk/types.md#token-request); a [`TokenDetails`](https://ably.com/docs/api/realtime-sdk/types.md#token-details) (in JSON format); an [Ably JWT](https://ably.com/docs/api/realtime-sdk/authentication.md#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`](https://ably.com/docs/api/realtime-sdk/types.md#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](https://ably.com/docs/auth/token.md) | `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](https://ably.com/docs/auth/identified-clients.md) | `String` |
| useTokenAuth | When true, forces [Token authentication](https://ably.com/docs/auth/token.md) to be used by the library. Please note that if a `clientId` is not specified in the [`ClientOptions`](https://ably.com/docs/api/realtime-sdk/types.md#client-options) or [`TokenParams`](https://ably.com/docs/api/realtime-sdk/types.md#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](https://ably.com/docs/platform/account/enterprise-customization.md) 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](https://ably.com/docs/platform/account/enterprise-customization.md) 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` |
| 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`](https://ably.com/docs/connect.md#heartbeats) and [`remainPresentFor`](https://ably.com/docs/presence-occupancy/presence.md#unstable-connections) | `Object` |
| logLevel | An enum controlling the verbosity of the output from `ARTLogLevelVerbose` to `ARTLogLevelNone`. A special value of 99 will silence all logging. The default is `ARTLogLevelWarn`. | `ARTLogLevel` |
| 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](https://ably.com/docs/auth/token.md) instead of relying on a locally-available time of day. Knowing the time accurately is needed to create valid signed Ably [TokenRequests](https://ably.com/docs/api/rest-sdk/authentication.md#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](https://ably.com/docs/api/rest-sdk/types.md#token-params) object is provided, it will override the client library defaults when issuing new [Ably Tokens](https://ably.com/docs/api/realtime-sdk/authentication.md#token-details) or [Ably TokenRequests](https://ably.com/docs/api/rest-sdk/authentication.md#token-request) | [`TokenParams`](https://ably.com/docs/api/rest-sdk/types.md#token-params) |
| 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](https://ably.com/docs/auth/basic.md) | `String` |
| :token | An authenticated token. This can either be a [`TokenDetails`](https://ably.com/docs/api/realtime-sdk/types.md#token-details) object, a [`TokenRequest`](https://ably.com/docs/api/realtime-sdk/types.md#token-request) object, or token string (obtained from the `token` property of a [`TokenDetails`](https://ably.com/docs/api/realtime-sdk/types.md#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](https://ably.com/docs/auth/token.md#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](https://ably.com/docs/auth/token.md) | `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`](https://ably.com/docs/api/realtime-sdk/types.md#token-request); a [`TokenDetails`](https://ably.com/docs/api/realtime-sdk/types.md#token-details) (in JSON format); an [Ably JWT](https://ably.com/docs/api/realtime-sdk/authentication.md#ably-jwt). See [our authentication documentation](https://ably.com/docs/auth.md) 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`](https://ably.com/docs/api/realtime-sdk/types.md#token-request); a [`TokenDetails`](https://ably.com/docs/api/realtime-sdk/types.md#token-details) (in JSON format); an [Ably JWT](https://ably.com/docs/api/realtime-sdk/authentication.md#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`](https://ably.com/docs/api/realtime-sdk/types.md#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](https://ably.com/docs/auth/token.md) | `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](https://ably.com/docs/auth/identified-clients.md) | `String` |
| :use_token_auth | When true, forces [Token authentication](https://ably.com/docs/auth/token.md) to be used by the library. Please note that if a `client_id` is not specified in the [`ClientOptions`](https://ably.com/docs/api/realtime-sdk/types.md#client-options) or [`TokenParams`](https://ably.com/docs/api/realtime-sdk/types.md#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](https://ably.com/docs/platform/account/enterprise-customization.md) 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](https://ably.com/docs/platform/account/enterprise-customization.md) 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` |
| :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`](https://ably.com/docs/connect.md#heartbeats) and [`remainPresentFor`](https://ably.com/docs/presence-occupancy/presence.md#unstable-connections) | `Hash` |
| :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](https://ably.com/docs/auth/token.md) instead of relying on a locally-available time of day. Knowing the time accurately is needed to create valid signed Ably [TokenRequests](https://ably.com/docs/api/rest-sdk/authentication.md#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](https://ably.com/docs/api/rest-sdk/types.md#token-params) object is provided, it will override the client library defaults when issuing new [Ably Tokens](https://ably.com/docs/api/realtime-sdk/authentication.md#token-details) or [Ably TokenRequests](https://ably.com/docs/api/rest-sdk/authentication.md#token-request) | [`TokenParams`](https://ably.com/docs/api/rest-sdk/types.md#token-params) |
| 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](https://ably.com/docs/auth/basic.md) | `String` |
| token | An authenticated token. This can either be a [`TokenDetails`](https://ably.com/docs/api/realtime-sdk/types.md#token-details) object, a [`TokenRequest`](https://ably.com/docs/api/realtime-sdk/types.md#token-request) object, or token string (obtained from the `token` property of a [`TokenDetails`](https://ably.com/docs/api/realtime-sdk/types.md#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](https://ably.com/docs/auth/token.md#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](https://ably.com/docs/auth/token.md) | `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`](https://ably.com/docs/api/realtime-sdk/types.md#token-request); a [`TokenDetails`](https://ably.com/docs/api/realtime-sdk/types.md#token-details) (in JSON format); an [Ably JWT](https://ably.com/docs/api/realtime-sdk/authentication.md#ably-jwt). See [our authentication documentation](https://ably.com/docs/auth.md) 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`](https://ably.com/docs/api/realtime-sdk/types.md#token-request); a [`TokenDetails`](https://ably.com/docs/api/realtime-sdk/types.md#token-details) (in JSON format); an [Ably JWT](https://ably.com/docs/api/realtime-sdk/authentication.md#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`](https://ably.com/docs/api/realtime-sdk/types.md#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](https://ably.com/docs/auth/token.md) | `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](https://ably.com/docs/auth/identified-clients.md) | `String` |
| useTokenAuth | When true, forces [Token authentication](https://ably.com/docs/auth/token.md) to be used by the library. Please note that if a `clientId` is not specified in the [`ClientOptions`](https://ably.com/docs/api/realtime-sdk/types.md#client-options) or [`TokenParams`](https://ably.com/docs/api/realtime-sdk/types.md#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](https://ably.com/docs/platform/account/enterprise-customization.md) 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](https://ably.com/docs/platform/account/enterprise-customization.md) 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`](https://ably.com/docs/connect.md#heartbeats) and [`remainPresentFor`](https://ably.com/docs/presence-occupancy/presence.md#unstable-connections) | Associative Array |
| 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](https://ably.com/docs/auth/token.md) instead of relying on a locally-available time of day. Knowing the time accurately is needed to create valid signed Ably [TokenRequests](https://ably.com/docs/api/rest-sdk/authentication.md#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](https://ably.com/docs/api/rest-sdk/types.md#token-params) object is provided, it will override the client library defaults when issuing new [Ably Tokens](https://ably.com/docs/api/realtime-sdk/authentication.md#token-details) or [Ably TokenRequests](https://ably.com/docs/api/rest-sdk/authentication.md#token-request) | [`TokenParams`](https://ably.com/docs/api/rest-sdk/types.md#token-params) |
| 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](https://ably.com/docs/auth/basic.md) | `String` |
| token | An authenticated token. This can either be a [`TokenDetails`](https://ably.com/docs/api/realtime-sdk/types.md#token-details) object, a [`TokenRequest`](https://ably.com/docs/api/realtime-sdk/types.md#token-request) object, or token string (obtained from the `token` property of a [`TokenDetails`](https://ably.com/docs/api/realtime-sdk/types.md#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](https://ably.com/docs/auth/token.md#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](https://ably.com/docs/auth/token.md) | `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`](https://ably.com/docs/api/realtime-sdk/types.md#token-request); a [`TokenDetails`](https://ably.com/docs/api/realtime-sdk/types.md#token-details) (in JSON format); an [Ably JWT](https://ably.com/docs/api/realtime-sdk/authentication.md#ably-jwt). See [our authentication documentation](https://ably.com/docs/auth.md) 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`](https://ably.com/docs/api/realtime-sdk/types.md#token-request); a [`TokenDetails`](https://ably.com/docs/api/realtime-sdk/types.md#token-details) (in JSON format); an [Ably JWT](https://ably.com/docs/api/realtime-sdk/authentication.md#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`](https://ably.com/docs/api/realtime-sdk/types.md#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](https://ably.com/docs/auth/token.md) | `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](https://ably.com/docs/auth/identified-clients.md) | `String` |
| use_token_auth | When true, forces [Token authentication](https://ably.com/docs/auth/token.md) to be used by the library. Please note that if a `client_id` is not specified in the [`ClientOptions`](https://ably.com/docs/api/realtime-sdk/types.md#client-options) or [`TokenParams`](https://ably.com/docs/api/realtime-sdk/types.md#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](https://ably.com/docs/platform/account/enterprise-customization.md) 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](https://ably.com/docs/platform/account/enterprise-customization.md) 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`](https://ably.com/docs/connect.md#heartbeats) and [`remainPresentFor`](https://ably.com/docs/presence-occupancy/presence.md#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](https://ably.com/docs/auth/token.md) instead of relying on a locally-available time of day. Knowing the time accurately is needed to create valid signed Ably [TokenRequests](https://ably.com/docs/api/rest-sdk/authentication.md#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](https://ably.com/docs/api/rest-sdk/types.md#token-params) object is provided, it will override the client library defaults when issuing new [Ably Tokens](https://ably.com/docs/api/realtime-sdk/authentication.md#token-details) or [Ably TokenRequests](https://ably.com/docs/api/rest-sdk/authentication.md#token-request) | [`TokenParams`](https://ably.com/docs/api/rest-sdk/types.md#token-params) |
| 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](https://ably.com/docs/auth/basic.md) | `String` |
| token | An authenticated token. This can either be a [`TokenDetails`](https://ably.com/docs/api/realtime-sdk/types.md#token-details) object, a [`TokenRequest`](https://ably.com/docs/api/realtime-sdk/types.md#token-request) object, or token string (obtained from the `token` property of a [`TokenDetails`](https://ably.com/docs/api/realtime-sdk/types.md#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](https://ably.com/docs/auth/token.md#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](https://ably.com/docs/auth/token.md) | `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`](https://ably.com/docs/api/realtime-sdk/types.md#token-request); a [`TokenDetails`](https://ably.com/docs/api/realtime-sdk/types.md#token-details) (in JSON format); an [Ably JWT](https://ably.com/docs/api/realtime-sdk/authentication.md#ably-jwt). See [our authentication documentation](https://ably.com/docs/auth.md) 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`](https://ably.com/docs/api/realtime-sdk/types.md#token-request); a [`TokenDetails`](https://ably.com/docs/api/realtime-sdk/types.md#token-details) (in JSON format); an [Ably JWT](https://ably.com/docs/api/realtime-sdk/authentication.md#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`](https://ably.com/docs/api/realtime-sdk/types.md#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](https://ably.com/docs/auth/token.md) | `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](https://ably.com/docs/auth/identified-clients.md) | `String` |
| useTokenAuth | When true, forces [Token authentication](https://ably.com/docs/auth/token.md) to be used by the library. Please note that if a `clientId` is not specified in the [`ClientOptions`](https://ably.com/docs/api/realtime-sdk/types.md#client-options) or [`TokenParams`](https://ably.com/docs/api/realtime-sdk/types.md#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](https://ably.com/docs/platform/account/enterprise-customization.md) 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](https://ably.com/docs/platform/account/enterprise-customization.md) 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`](https://ably.com/docs/connect.md#heartbeats) and [`remainPresentFor`](https://ably.com/docs/presence-occupancy/presence.md#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](https://ably.com/docs/auth/token.md) instead of relying on a locally-available time of day. Knowing the time accurately is needed to create valid signed Ably [TokenRequests](https://ably.com/docs/api/rest-sdk/authentication.md#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](https://ably.com/docs/api/rest-sdk/types.md#token-params) object is provided, it will override the client library defaults when issuing new [Ably Tokens](https://ably.com/docs/api/realtime-sdk/authentication.md#token-details) or [Ably TokenRequests](https://ably.com/docs/api/rest-sdk/authentication.md#token-request) | [`TokenParams`](https://ably.com/docs/api/rest-sdk/types.md#token-params) |
### ClientOptions ObjectARTChannelOptionsChannelOptions HashChannelOptions Arrayio.ably.lib.types.ChannelOptionsIO.Ably.ChannelOptions
Channel options are used for setting [channel parameters](https://ably.com/docs/channels/options.md) and [configuring encryption](https://ably.com/docs/channels/options/encryption.md).
`ChannelOptions`, a plain JavaScript object, may optionally be specified when instancing a [`Channel`](https://ably.com/docs/channels.md), and this may be used to specify channel-specific options. The following attributes can be defined on the object:
`ChannelOptions`, a Hash object, may optionally be specified when instancing a [`Channel`](https://ably.com/docs/channels.md), and this may be used to specify channel-specific options. The following key symbol values can be added to the Hash:
`ChannelOptions`, an Associative Array, may optionally be specified when instancing a [`Channel`](https://ably.com/docs/channels.md), and this may be used to specify channel-specific options. The following named keys and values can be added to the Associated Array:
`ART``io.ably.lib.types.``ChannelOptions` may optionally be specified when instancing a [`Channel`](https://ably.com/docs/channels.md), and this may be used to specify channel-specific options.
`IO.Ably.ChannelOptions` may optionally be specified when instancing a [`Channel`](https://ably.com/docs/channels.md), and this may be used to specify channel-specific options.
#### PropertiesMembersAttributes
| Parameter | Description | Type |
|-----------|-------------|------|
| :cipherCipherParams | Requests encryption for this channel when not null, and specifies encryption-related parameters (such as algorithm, chaining mode, key length and key). See [an example](https://ably.com/docs/channels/options/encryption.md) | [`CipherParams`](https://ably.com/docs/api/realtime-sdk/encryption.md#cipher-params) or an options hash containing at a minimum a `key`[`CipherParams`](https://ably.com/docs/api/realtime-sdk/encryption.md#cipher-params) |
| Parameter | Description | Type |
|-----------|-------------|------|
| paramsParams | Optional [parameters](https://ably.com/docs/channels/options.md) which specify behaviour of the channel. | `Map`JSON Object |
| cipherCipherParams | Requests encryption for this channel when not null, and specifies encryption-related parameters (such as algorithm, chaining mode, key length and key). See [an example](https://ably.com/docs/api/realtime-sdk/encryption.md#getting-started) | [`CipherParams`](https://ably.com/docs/api/realtime-sdk/encryption.md#cipher-params) or an options object containing at a minimum a `key`[`CipherParams`](https://ably.com/docs/api/realtime-sdk/encryption.md#cipher-params) or a `Param[]` list containing at a minimum a `key`[`CipherParams`](https://ably.com/docs/api/realtime-sdk/encryption.md#cipher-params) or an Associative Array containing at a minimum a `key`[`CipherParams`](https://ably.com/docs/api/realtime-sdk/encryption.md#cipher-params) |
#### Static methods
##### withCipherKey
`static ChannelOptions.withCipherKey(Byte[] or String key)`
A helper method to generate a `ChannelOptions` for the simple case where you only specify a key.
##### Parameters
| Parameter | Description | Type |
|-----------|-------------|------|
| key | A binary `Byte[]` array or a base64-encoded `String`. | |
##### Returns
On success, the method returns a complete `ChannelOptions` object. Failure will raise an [`AblyException`](https://ably.com/docs/api/realtime-sdk/types.md#ably-exception).
### CipherParamsARTCipherParamsCipherParams HashCipherParams Arrayio.ably.lib.util.Crypto.CipherParamsIO.Ably.CipherParams
A `CipherParams` contains configuration options for a channel cipher, including algorithm, mode, key length and key. Ably client libraries currently support AES with CBC, PKCS#7 with a default key length of 256 bits. All implementations also support AES128.
Individual client libraries may support either instancing a `CipherParams` directly, using [`Crypto.getDefaultParams()`](https://ably.com/docs/api/realtime-sdk/encryption.md#get-default-params)[`Crypto.GetDefaultParams()`](https://ably.com/docs/api/realtime-sdk/encryption.md#get-default-params)[`Crypto.get_default_params()`](https://ably.com/docs/api/realtime-sdk/encryption.md#get-default-params), or generating one automatically when initializing a channel, as in [this example](https://ably.com/docs/channels/options/encryption.md).
#### PropertiesMembersAttributes
| Parameter | Description | Type |
|-----------|-------------|------|
| keyKey:key | A binary (`byte[]``ArrayBuffer` or `Uint8Array``Buffer`byte array`NSData`) or base64-encoded `NS``String` containing the secret key used for encryption and decryption | |
| algorithm:algorithmAlgorithm | The name of the algorithm in the default system provider, or the lower-cased version of it; eg "aes" or "AES". The default is AES. | `String` |
| key_length:key_lengthkeyLengthKeyLength | The key length in bits of the cipher, either 128 or 256. The default is 256. | `Integer` |
| mode:modeMode | The cipher mode. The default is CBC. | `String``CipherMode` |
| Parameter | Description | Type |
|-----------|-------------|------|
| algorithm:algorithmAlgorithm | The name of the algorithm in the default system provider, or the lower-cased version of it; eg "aes" or "AES". The default is AES. | `String` |
| key_length:key_lengthkeyLengthKeyLength | The key length in bits of the cipher, either 128 or 256. The default is 256. | `Integer` |
| mode:modeMode | The cipher mode. The default is CBC. | `String``CipherMode` |
| Parameter | Description | Type |
|-----------|-------------|------|
| algorithm:algorithmAlgorithm | The name of the algorithm in the default system provider, or the lower-cased version of it; eg "aes" or "AES". The default is AES. | `String` |
| key_length:key_lengthkeyLengthKeyLength | The key length in bits of the cipher, either 128 or 256. The default is 256. | `Integer` |
| mode:modeMode | The cipher mode. The default is CBC. | `String``CipherMode` |
| keySpec | A `KeySpec` for the cipher key | `SecretKeySpec` |
### IO.Ably.StatsRequestParams
`StatsRequestParams` is a type that encapsulates the parameters for a stats query. For example usage see [`Realtime#Stats`](https://ably.com/docs/metadata-stats/stats.md).
#### Members
| Parameter | Description | Type |
|-----------|-------------|------|
| Start | The start of the queried interval. The default is null. | `DateTimeOffset` |
| End | The end of the queried interval. The default is null. | `DateTimeOffset` |
| Limit | Limits the number of items returned by history or stats. The default is null. | `Integer` |
| Direction | Enum which is either `Forwards` or `Backwards`. The default is `Backwards`. | `Direction` enum |
| Unit | `Minute`, `Hour`, `Day`, `Month`. Based on the unit selected, the given start or end times are rounded down to the start of the relevant interval depending on the unit granularity of the query. The default is `Minute`. | [`StatsIntervalGranularity`](https://ably.com/docs/api/realtime-sdk/types.md#stats-granularity) enum |
| ExtraParameters | Optionally any extra query parameters that may be passed to the query. This is mainly used internally by the library to manage paging. | `Dictionary` |
### TokenParams ObjectARTTokenParamsTokenParams HashTokenParams Arrayio.ably.lib.rest.Auth.TokenParamsIO.Ably.TokenParams
`TokenParams` is a plain JavaScript object and is used in the parameters of [token authentication](https://ably.com/docs/auth/token.md) requests, corresponding to the desired attributes of the [Ably Token](https://ably.com/docs/api/realtime-sdk/authentication.md#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](https://ably.com/docs/auth/token.md) requests, corresponding to the desired attributes of the [Ably Token](https://ably.com/docs/api/realtime-sdk/authentication.md#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](https://ably.com/docs/auth/token.md) requests, corresponding to the desired attributes of the [Ably Token](https://ably.com/docs/api/realtime-sdk/authentication.md#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](https://ably.com/docs/auth/token.md) requests, corresponding to the desired attributes of the [Ably Token](https://ably.com/docs/api/realtime-sdk/authentication.md#token-details). The following named keys and values can be added to the Associative Array:
`TokenParams` is used in the parameters of [token authentication](https://ably.com/docs/auth/token.md) requests, corresponding to the desired attributes of the [Ably Token](https://ably.com/docs/api/realtime-sdk/authentication.md#token-details).
`ARTTokenParams` is used in the parameters of [token authentication](https://ably.com/docs/auth/token.md) requests, corresponding to the desired attributes of the [Ably Token](https://ably.com/docs/api/realtime-sdk/authentication.md#token-details).
#### PropertiesMembersAttributes
| Parameter | Description | Type |
|-----------|-------------|------|
| capabilityCapability:capability | JSON stringified capability of the [Ably Token](https://ably.com/docs/api/realtime-sdk/authentication.md#token-details). If the [Ably Token](https://ably.com/docs/api/realtime-sdk/authentication.md#token-details) request is successful, the capability of the returned [Ably Token](https://ably.com/docs/api/realtime-sdk/authentication.md#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](https://ably.com/docs/auth/capabilities.md). | `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](https://ably.com/docs/auth/identified-clients.md) | `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](https://ably.com/docs/api/realtime-sdk/authentication.md#token-details) from being replayed. | `Integer``Long Integer``Time``NSDate``DateTimeOffset``DateTime` |
| ttlTtl:ttl | Requested time to live for the [Ably Token](https://ably.com/docs/api/realtime-sdk/authentication.md#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` |
### TokenRevocationTargetSpecifier
A `TokenRevocationTargetSpecifier` describes which tokens should be affected by a token revocation request.
#### Properties
| Parameter | Description | Type |
|-----------|-------------|------|
| type | The type of token revocation target specifier. Valid values include `clientId`, `revocationKey` and `channel` | `String` |
| value | The value of the token revocation target specifier | `String` |
### TokenRevocationOptions
A `TokenRevocationOptions` describes the additional options accepted by revoke tokens request.
#### Properties
| Parameter | Description | Type |
|-----------|-------------|------|
| issuedBefore | An optional Unix timestamp in milliseconds where only tokens issued before this time are revoked. The default is the current time. Requests with an `issuedBefore` in the future, or more than an hour in the past, will be rejected | `Number` |
| allowReauthMargin | If true, 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. The default is `false`, meaning that the effect is near-immediate. | `Boolean` |