Constructor
- Methods
- Related types
Constructor
The Ably REST library constructor is overloaded allowing it to be instantiated using a ClientOptions
object, or more simply using a string containing an API key or Token.
new Ably.Rest(String keyOrTokenId)Ably::Rest.new(String key_or_token_id)new Ably\AblyRest(String key_or_token_id)new io.ably.lib.AblyRest(String keyOrTokenIdString)new IO.Ably.AblyRest(string key);- (instancetype)initWithKey:(NSString )key
(instancetype)initWithToken:(NSString *)tokeninit(key: String)
init(token: String)AblyRest(String api_key)ably.Rest(key: keyOrTokenIdString)NewRestClient(keyOrTokenId string) (RestClient, error)
This will instantiate the REST library with the provided API key or Token ID string.
new Ably.Rest(ClientOptions clientOptions)Ably::Rest.new(ClientOptions client_options)new Ably\AblyRest(ClientOptions client_options)new io.ably.lib.AblyRest(ClientOptions clientOptions)new IO.Ably.AblyRest(ClientOptions clientOptions)- (instancetype)initWithOptions:(ARTClientOptions )options;init(options: ARTClientOptions)AblyRest(ClientOptions client_options)ably.Rest(options: ClientOptions clientOptions)NewRestClient(opts
ClientOptions) (*RestClient, error)
This will instantiate the library using the specified ClientOptions.
This will instantiate the library and create a new Ably::Rest::Client
using the specified ClientOptions
.
The REST constructor is used to instantiate the library. The REST library may be instantiated multiple times with the same or different ClientOptions
in any given context. Except where specified otherwise, instances operate independently of one another.
Authentication
The REST library needs to have credentials to be able to authenticate with the Ably service. Ably supports both Basic and Token based authentication schemes. Read more on authentication.
Basic Authentication
A private API key string for ClientOptions#key
ClientOptions#Key
or the constructor, as obtained from the application dashboard, is required for Basic Authentication. Use this option if you wish to use Basic authentication, or if you want to be able to request Ably Tokens without needing to defer to a separate entity to sign Ably TokenRequests. Note that initializing the library with a key
Key
does not necessarily mean that the library will use Basic auth; using the private key it is also able to create and sign Ably TokenRequests and use token authentication when necessary.
Token Authentication
The ClientOptions#token
ClientOptions#Token
option takes a token
string, and assumes that the Ably-compatible token has been obtained from some other instance that requested the token. Use the token option if you are provided with a token to use and you do not have a key (or do not have a key with the capabilities that you require).
Since tokens are short-lived, it is rarely sufficient to start with a token without the means for refreshing it. The authUrl
and authCallback
:auth_url
and :auth_callback
auth_url
and auth_callback
AuthUrl
and AuthCallback
options are provided to allow a user of the library to provide new Ably-compatible tokens or Ably TokenRequests to the library as required; using these options allows the library to be instantiated without a key
or token
Key
or Token
, and an initial token will be obtained automatically when required.
Read more on authentication.
AblyRest PropertiesAbly.Rest Propertiesio.ably.lib.AblyRest MembersAbly::Rest::Client AttributesARTRest Propertiesably.Rest Properties
The REST client exposes the following public attributesmembersproperties:
authAuth
A reference to the Auth
authentication object configured for this client library.
push
A reference to the Push
ARTPush
object in this client library.
device
A reference to the LocalDevice
ARTLocalDevice
object.
channelsChannels
Channels
is a reference to the Channel
collection instance for this library indexed by the channel name. You can use the Get
method of this to get a Channel
instance. See channels and messages for more information.
AblyRest MethodsAbly.Rest Methodsio.ably.lib.AblyRest MethodsAbly::Rest::Client MethodsARTRealtime Methodsably.Rest Methods
statsStats
stats(Object options, callback(ErrorInfo err, PaginatedResult<Stats> results))PaginatedResult<Stats> stats(Hash options)PaginatedResult<Stats> stats(kwargs_options)PaginatedResult<Stats> stats(Array options)PaginatedResult<Stats> stats(Param[] options)Task<PaginatedResult<Stats>> StatsAsync(StatsRequestParams query)stats(query: ARTStatsQuery?, callback: (ARTPaginatedResult#/realtime/types#paginated-result<ARTStats>?, ARTErrorInfo?) → Void) throws(c *RestClient) Stats(params *PaginateParams) (*PaginatedResult, error)
This call queries the REST /stats
API and retrieves your application’s usage statistics. A PaginatedResult is returned, containing an array of Stats for the first page of results. PaginatedResult objects are iterable providing a means to page through historical statistics. See an example set of raw stats returned via the REST API.
See statistics for more information.
Parameters
- optionsquery
- an optional objectHash
ARTStatsQuery
StatsRequestParams
Param
[] array containing the query parameters
- callback
- is a function of the form:
function(err, result)
- &block
- yields a
PaginatedResult<Stats>
object - callback
- called with a ARTPaginatedResult<ARTStats> object or an error
options
parametersARTStatsQuery
propertiesStatsRequestParams
properties
The following options, as defined in the REST /stats
API endpoint, are permitted:
- start:startStart
-
beginning of time earliest
DateTimeOffset
orTime
or time in milliseconds since the epoch for any stats retrieved
Type:Long
Int or @Time
DateTimeOffset
- end:endEnd
-
current time latest
DateTimeOffset
orTime
or time in milliseconds since the epoch for any stats retrieved
Type:Long
Int or @Time
DateTimeOffset
- direction:directionDirection
-
backwards
:
forwards
or:
backwards
Type:String
Symbol
Direction
enum - limit:limitLimit
-
100 maximum number of messages to retrieve up to 1,000
Type:Integer
- unit:unitUnit
-
minute
:
minute
,:
hour
,:
day
or:
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
Type:String
ARTStatsGranularity
Symbol
StatsIntervalGranularity
enum
Callback result
On success, result
contains a PaginatedResult
encapsulating an array of Stats
objects corresponding to the current page of results. PaginatedResult
supports pagination using next
and first
methods.
On failure to retrieve stats, err
contains an ErrorInfo
object with an error response as defined in the Ably REST API documentation.
Returns
On success, the returned PaginatedResult
encapsulates an array of Stats
objects corresponding to the current page of results. PaginatedResult
supports pagination using next
and first
methods.
Failure to retrieve the stats will raise an AblyException
Returns
The method is asynchronous and return Task which needs to be awaited.
On success, the returned PaginatedResult
encapsulates a list of Stats
objects corresponding to the current page of results. PaginatedResult
supports pagination using NextAsync
and FirstAsync
methods.
Failure to retrieve the stats will raise an AblyException
timeTime
time(callback(ErrorInfo err, Number time))Time timeInt time()Integer time()long time()Task
TimeAsync() time(callback: (NSDate?, NSError?) → Void)(c *RestClient) Time() (time.Time, error)
Obtains the time from the Ably service as a Time
objecta DateTimeOffset
objectmilliseconds since epoch. (Clients that do not have access to a sufficiently well maintained time source and wish to issue Ably TokenRequests with a more accurate timestamp should use the queryTime
clientOptions instead of this method).
Callback result
On success, time
is a number containing the number of milliseconds since the epoch.
On failure to retrieve the Ably server time, err
contains an ErrorInfo
object with an error response as defined in the Ably REST API documentation.
Returns
On success, milliseconds since epochthe Time
the DateTimeOffset
is returned.
Failure to retrieve the Ably server time will raise an AblyException
.
Returns
On success, milliseconds since epochthe Time
the DateTimeOffset
is returned.
On failure to retrieve the Ably server time, error
contains an ErrorInfo
object with an error response as defined in the Ably REST API documentation.
requestRequest
request(String method, String path, Object params, Object body, Object headers, callback(ErrorInfo err, HttpPaginatedResponse results))HttpPaginatedResponse request(String method, String path, Object params, Object body, Object headers)publish(method=String, path=String, params=Object, body=Object, headers=Object)HttpPaginatedResponse request(String method, String path, Object params, Object body, Object headers)Task<HttpPaginatedResponse> Request(string method, string path, Dictionary<string, string> requestParams, JToken body, Dictionary<string, string> headers)request(method: String, path: String, params: Object?, body: Object?, headers: Object?, callback: (ARTHttpPaginatedResponse, ARTErrorInfo?) → Void)HTTPPaginatedResponse Request(method string, path string, params PaginateParams, body interface, headers http.Header)
Makes a REST request to a provided path. This is provided as a convenience for developers who wish to use REST API functionality that is either not documented or is not yet included in the public API, without having to handle authentication, paging, fallback hosts, MsgPack and JSON support, etc. themselves.
Parameters
- method
- either
get
,post
,put
,patch
ordelete
.
Type: Stringstring - path
- the path to query.
Type: Stringstring - params
- (optional) any querystring parameters needed.
Type: ObjectPaginateParamsDictionary<string, string> - body
- (optional; for
post
,put
andpatch
methods) the body of the request, as anything that can be serialized into JSON, such as anObject
orArray
.a JToken.
Type: SerializableinterfaceJToken - headers
- (optional) any headers needed. If provided, these will be mixed in with the default library headers.
Type: Objecthttp.HeaderDictionary<string, string>
Callback result
On successfully receiving a response from Ably, results
contains an HttpPaginatedResponse
ARTHttpPaginatedResponse
containing the statusCode
of the response, a success
boolean (equivalent to whether the status code is between 200 and 299), headers
, and an items
array containing the current page of results. It supports pagination using next
and first
methods, identically to PaginatedResult
.
On failure to obtain a response, err
contains an ErrorInfo
object with an error response as defined in the Ably REST API documentation. (Note that if a response is obtained, any response, even with a non-2xx status code, will result in an HTTP Paginated Response, not an err
).
Returns
On successfully receiving a response from Ably, the returned HttpPaginatedResponse
contains a status_code
statusCode
and a success
boolean, headers
, and an items
array containing the current page of results. It supports pagination using next
and first
methods, identically to PaginatedResult
.
Failure to obtain a response will raise an AblyException
. (Note that if a response is obtained, any response, even with a non-2xx status code, will result in an HTTP Paginated Response, not an exception).
Returns
The method is asynchronous and return a Task that has to be awaited to get the result.
On successfully receiving a response from Ably, the returned HttpPaginatedResponse
containing the StatusCode
and a Success
boolean, Headers
, and an Items
array containing the current page of results. HttpPaginatedResponse
supports pagination using NextAsync
and FirstAsync
methods.
Failure to obtain a response will raise an AblyException
. (Note that if a response is obtained, any response, even with a non-2xx status code, will result in an HTTP Paginated Response, not an exception).
Example
rest.request(
'get',
'/channels/someChannel/messages',
{limit: 1, direction: 'forwards'},
null,
null,
function(err, response) {
if(err) {
console.log('An error occurred; err = ' + err.toString());
} else {
console.log('Success! status code was ' + response.statusCode);
console.log(response.items.length + ' items returned');
if(response.hasNext()) {
response.next(function(err, nextPage) {
console.log(nextPage.items.length + ' more items returned');
});
}
}
});
rest.request(
'get',
'/channels/someChannel/messages',
{limit: 1, direction: 'forwards'},
null,
null,
function(err, response) {
if(err) {
console.log('An error occurred; err = ' + err.toString());
} else {
console.log('Success! status code was ' + response.statusCode);
console.log(response.items.length + ' items returned');
if(response.hasNext()) {
response.next(function(err, nextPage) {
console.log(nextPage.items.length + ' more items returned');
});
}
}
});
Related types
ClientOptionsARTClientOptionsio.ably.types.ClientOptionsIO.Ably.ClientOptionsably.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
PropertiesMembersAttributesKeyword arguments
- keyKey:key
- The full key string, as obtained from the application 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
Type:String
- tokenToken:token
- An authenticated token. This can either be a
TokenDetails
object, aTokenRequest
object, or token string (obtained from thetoken
Token
property of aTokenDetails
component of an Ably TokenRequest response, or a JSON Web Token satisfying the Ably requirements for JWTs). 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 asauthUrl
AuthUrl
:auth_urlauth_url orauthCallback
AuthCallback
auth_callback
:auth_callback
. Read more about Token authentication
Type:String
,TokenDetails
orTokenRequest
- 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 signedTokenRequest
; aTokenDetails
(in JSON format); an Ably JWT. See an authentication callback example or our authentication documentation for details of the Ably TokenRequest format and associated API calls.
Type:Callable
TokenCallback
Proc
Func<TokenParams, Task<TokenDetails>>
- 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
; aTokenDetails
(in JSON format); an Ably JWT. For example, this can be used by a client to obtain signed Ably TokenRequests from an application server.
Type:String
Uri
NSURL
- authMethodAuthMethodauth_method:auth_method
-
GET
:get
The HTTP verb to use for the request, eitherGET
:get
orPOST
:post
Type: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 theauthHeaders
object contains anauthorization
key, thenwithCredentials
will be set on the xhr request.
Type:Object
Dict
Hash
Associative Array
Param []
Dictionary<string, string>
Map<String, String>
- authParamsAuthParams:auth_paramsauth_params
- A set of key value pair params to be added to any request made to the
authUrl
AuthUrl
. When theauthMethod
AuthMethod
isGET
, query params are added to the URL, whereas whenauthMethod
AuthMethod
isPOST
, the params are sent as URL encoded form data. Useful when an application require these to be added to validate the request or implement the response.
Type:Object
Hash
Associative Array
Param[]
Dictionary<string, string>
NSArray<NSURLQueryItem *>
[NSURLQueryItem]/Array<NSURLQueryItem>
Map<String, String>
- tokenDetailsTokenDetailstoken_details:token_details
- An authenticated
TokenDetails
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 asauthUrl
AuthUrl
:auth_url
auth_url
orauthCallback
AuthCallbackauth_callback
:auth_callback
. Use this option if you wish to use Token authentication. Read more about Token authentication
Type:TokenDetails
- tlsTls:tls
-
true 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
Type:Boolean
- clientIdClientIdclient_id:client_id
- A client ID, used for identifying this client when publishing messages or for presence purposes. The
clientId
client_id
ClientId
can be any non-empty string. This option is primarily intended to be used in situations where the library is instantiated with a key; note that aclientId
client_id
ClientId
may also be implicit in a token used to instantiate the library; an error will be raised if aclientId
client_id
specified here conflicts with theclientId
client_id
ClientId
implicit in the token. Find out more about client identities
Type:String
- useTokenAuthUseTokenAuthuse_token_auth:use_token_auth
-
false When true, forces Token authentication to be used by the library. Please note that if a
client_id
clientId
is not specified in theClientOptions
orTokenParams
, then the Ably Token issued will be anonymous.
Type:Boolean
- environmentEnvironment:environment
-
nullNullNonenil Enables enterprise customers to use their own custom environments, which support dedicated, isolated clusters and regional message routing and storage constraints. See our platform customization guide for more details.
Type:String
- idempotentRestPublishingIdempotentRestPublishing:idempotent_rest_publishing
-
false When true, enables idempotent publishing by assigning a unique message ID client-side, allowing the Ably servers to discard automatic publish retries following a failure such as a network fault. We recommend you enable this by default. In version 1.2 onwards, idempotent publishing for retries will be enabled by default.
Type:Boolean
- fallbackHostsFallbackHostsfallback_hosts:fallback_hosts
-
[a.ably-realtime.com, b.ably-realtime.com, c.ably-realtime.com, d.ably-realtime.com, e.ably-realtime.com]
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 is disabled. If your customer success manager has provided you with a set of custom fallback hosts, please specify them here.
Type:String []
- transportParamsTransportParamstransport_params:transport_params
- Optional. Can be used to pass in arbitrary connection parameters, such as
heartbeatInterval
andremainPresentFor
.
Type:Object
Dict
Hash
Associative Array
Param []
Dictionary<string, string>
Map<String, String>
- log
- Parameters to control the log output of the library. The supplied value must be an object that may contain one or both of the following entries:
-
level
: a number controlling the verbosity of the output. Valid values are: 0 (no logs), 1 (errors only), 2 (errors plus connection and channel state changes), 3 (abbreviated debug output), and 4 (full debug output). -
handler
: a function to handle each line of log output. Ifhandler
is not specified,console.log
is used.
Note that the log level and log handler have global scope in the library and will thus not act independently between library instances when multiple library instances exist concurrently.
Type:Object
-
- transports
- An optional array of transports to use, in descending order of preference. In the browser environment the available transports are:
web_socket
,xhr
,jsonp
.The transports available in the Node.js client library are:web_socket
,xhr
,comet
.
Type:String []
- logLevel
-
5 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 for more details.
Type:Integer
- logHandler
-
System.out PrintStream
ALogHandler
interface can be specified to handle each line of log output. IflogHandler
is not specified,System.out
is used. Note that thelogHandler
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 for more details.
Type: PrintStream
To set the log level and custom logger sink when using the .NET library, configure the static IO.Ably.Logger
class or specify the ClientOptions
:
- LogLevel
-
Error
This is an enum controlling the verbosity of the output fromDebug
(maximum) toError
(errors only). A special value ofNone
will silence all logging. Note that theLogLevel
is a static variable in the library and will thus not act independently between library instances.
Type:Enum
- LoggerSink
-
IO.Ably.DefaultLoggerSink
The default ILoggerSink outputs messages to the debug console. This property allows the user to pipe the log messages to their own logging infrastructure.
- LogLevel
-
LogError
This is an enum controlling the verbosity of the output fromLogDebug
(maximum) toLogError
(errors only). A special value ofLogNone
will silence all logging. Note that theLogLevel
is a static variable in the library and will thus not act independently between library instances.
Type:Enum
- logLevel
-
ARTLogLevelWarn An enum controlling the verbosity of the output from
ARTLogLevelVerbose
toARTLogLevelNone
. A special value of 99 will silence all logging.
Type:ARTLogLevel
- logHandler
- A
ARTLog
object can be specified to handle each line of log output. IflogHandler
is not specified, a defaultARTLog
instance is used.
Type:ARTLog *
- :log_level
-
:error
Log level for the standard Logger that outputs toSTDOUT
. Can be set to:fatal
,:error
,:warn
,:info
,:debug
or:none
. Alternatively aLogger
severity constant can be specified.
Type:Symbol
,Logger::SEVERITY
- :logger
-
STDOUT Logger
A RubyLogger
compatible object to handle each line of log output. Iflogger
is not specified,STDOUT
is used.
Type: Ruby @Logger
- logLevel
-
Log::WARNING
A number controlling the verbosity of the output from 1 (minimum, errors only) to 4 (most verbose);
Type:Integer
- logHandler
-
console.log
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.
Type:Function
- useBinaryProtocolUseBinaryProtocoluse_binary_protocol:use_binary_protocol
-
false 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)true If set to false, will forcibly disable the binary protocol (MessagePack). The binary protocol is used by default unless it is not supportedNote: The binary protocol is currently not supported in Swiftin Objective-Cin PHP. Find out more about the benefits of binary encoding
Type:Boolean
- logExceptionReportingUrl
- Defaults to a string value for an Ably error reporting Data Source Name.
Type:String
- queryTimeQueryTime:query_timequery_time
-
false If true, the library will query the Ably servers for the current time when issuing TokenRequests instead of relying on a locally-available time of day. Knowing the time accurately is needed to create valid signed Ably TokenRequests, 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 . The server is queried for the current time once per client library instance (which stores the offset from the local clock), so if using this option you should avoid instancing a new version of the library for each request.
Type:Boolean
- defaultTokenParamsdefault_token_params:default_token_paramsDefaultTokenParams
- When a TokenParams object is provided, it will override the client library defaults when issuing new Ably Tokens or Ably
TokenRequests
Type:TokenParams
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 as well as your application 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 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
- unit
- 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'
.
Type:Stats::GRANULARITY
StatsIntervalGranularity enum
ARTStatsGranularity
String
- interval_granularityintervalGranularity
- Deprecated alias for
unit
; scheduled to be removed in version 2.x client library versions.
Type:Stats::GRANULARITY
StatsIntervalGranularity 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 aStats
object whoseunit
isday
would indicate that the period covered is “2018-03-01:10 .. 2018-03-01:11”. AllStats
objects, except those whoseunit
isminute
, 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 theunit
by looking at the resolution of theintervalId
.Stats
objects covering an individual minute will have an interval ID indicating that time; for example “2018-03-01:10:02”.
Type:String
- interval_timeIntervalTime
- A
Time
DateTime
DateTimeOffset
object representing the parsedintervalId
interval_id
IntervalId
(the UTC time at which the time period covered by thisStats
object starts)
Type:Time
DateTime
DateTimeOffset
- allAll
- aggregate count of both
inbound
andoutbound
message stats
Type:MessageTypes
- apiRequestsapi_requestsApiRequests
- breakdown of API requests received via the Ably REST API
Type:RequestCount
- channelsChannels
- breakdown of channel related stats such as min, mean and peak channels
Type:ResourceCount
- connectionsConnections
- breakdown of connection related stats such as min, mean and peak connections for TLS and non-TLS connections
Type: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
Type: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
Type:MessageTraffic
- persistedPersisted
- messages persisted and later retrieved via the history API
Type:MessageTypes
- tokenRequeststoken_requestsTokenRequests
- breakdown of Ably Token requests received via the Ably REST API.
Type:RequestCount
- pushPush
- Detailed stats on push notifications, see our Push documentation for more details
Type:PushStats
ARTStatsGranularityStatsGranularity
ARTStatsGranularity
is an enum specifying the granularity of a ARTStats interval
.
typedef NS_ENUM(NSUInteger, ARTStatsGranularity) {
ARTStatsGranularityMinute,
ARTStatsGranularityHour,
ARTStatsGranularityDay,
ARTStatsGranularityMonth
};
enum ARTStatsGranularity : UInt {
case Minute
case Hour
case Day
case Month
}
StatsIntervalGranularity
is an enum specifying the granularity of a Stats interval
.
public enum StatsGranularity
{
Minute,
Hour,
Day,
Month
}
HttpPaginatedResponse
An HttpPaginatedResponse
is a superset of PaginatedResult
, 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.
PropertiesMembersAttributesAttributes
- itemsItems
- contains a page of results (for example an Array of
Message
orPresenceMessage
objects for a channel history request).
Type:Array<>
Type:List<>
- statusCodestatus_codeStatusCode
- the HTTP status code of the response
Type:Number
- successSuccess
- whether that HTTP status code indicates success (equivalent to
200 <= statusCode < 300
)
Type:Boolean
- headersHeaders
- the response’s headers
Type:Object
Methods
firstFirst
first(callback(ErrorInfo err, HttpPaginatedResponse resultPage))HttpPaginatedResponse firstHttpPaginatedResponse first()HttpPaginatedResponse first()Task<HttpPaginatedResponse
> FirstAsync() HttpPaginatedResponse first()first(callback: (ARTHttpPaginatedResponse?, ARTErrorInfo?) → Void)First() (HttpPaginatedResponse, error)
Returns a new HttpPaginatedResponse
for the first page of results. When using the Realtime library, the first
method returns a Deferrable and yields an HttpPaginatedResponse
.The method is asynchronous and returns a Task which needs to be awaited to get the @HttpPaginatedResponse":/api/realtime-sdk/types#http-paginated-response.
hasNextHasNexthas_next?has_next
Boolean hasNext()Boolean has_next?Boolean hasNext()Boolean has_next()Boolean HasNext()Boolean hasNext()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 isLast()Boolean is_last()Boolean IsLast()Boolean isLast()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(callback(ErrorInfo err, HttpPaginatedResponse resultPage))HttpPaginatedResponse nextHttpPaginatedResponse next()HttpPaginatedResponse next()Task<HttpPaginatedResponse
> NextAsync() HttpPaginatedResponse next()next(callback: (ARTHttpPaginatedResponse?, ARTErrorInfo?) → Void)Next() (HttpPaginatedResponse, error)
Returns a new HttpPaginatedResponse
loaded with the next page of results. If there are no further pages, then null
a blank HttpPaginatedResponse will be returnedNull
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 and yields an HttpPaginatedResponse.
Example
The HttpPaginatedResponse
interface is a superset of PaginatedResult
, see the PaginatedResult
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
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
- key
- The key value
Type:String
- value
- The value associated with the
key
Type:String