public class AblyRest
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
class |
AblyRest.Channels
A collection of Channels associated with an Ably instance.
|
| Modifier and Type | Field and Description |
|---|---|
Auth |
auth |
AblyRest.Channels |
channels |
Http |
http |
HttpCore |
httpCore |
ClientOptions |
options |
| Constructor and Description |
|---|
AblyRest(ClientOptions options)
Instance the Ably library with the given options.
|
AblyRest(java.lang.String key)
Instance the Ably library using a key only.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
onAuthError(ErrorInfo errorInfo)
Authentication error occurred
|
protected void |
onAuthUpdated(java.lang.String token,
boolean waitForResponse)
Override this method in AblyRealtime and pass updated token to ConnectionManager
|
PublishResponse[] |
publishBatch(Message.Batch[] pubSpecs,
ChannelOptions channelOptions)
Publish a messages on one or more channels.
|
void |
publishBatchAsync(Message.Batch[] pubSpecs,
ChannelOptions channelOptions,
Callback<PublishResponse[]> callback) |
HttpPaginatedResponse |
request(java.lang.String method,
java.lang.String path,
Param[] params,
HttpCore.RequestBody body,
Param[] headers)
Make a generic HTTP request against an endpoint representing a collection
of some type; this is to provide a forward compatibility path for new APIs.
|
void |
requestAsync(java.lang.String method,
java.lang.String path,
Param[] params,
HttpCore.RequestBody body,
Param[] headers,
AsyncHttpPaginatedResponse.Callback callback)
Make an async generic HTTP request against an endpoint representing a collection
of some type; this is to provide a forward compatibility path for new APIs.
|
PaginatedResult<Stats> |
stats(Param[] params)
Request usage statistics for this application.
|
void |
statsAsync(Param[] params,
Callback<AsyncPaginatedResult<Stats>> callback)
Asynchronously obtain usage statistics for this application using the REST API.
|
long |
time()
Obtain the time from the Ably service.
|
void |
timeAsync(Callback<java.lang.Long> callback)
Asynchronously obtain the time from the Ably service.
|
public final ClientOptions options
public final Http http
public final HttpCore httpCore
public final Auth auth
public final AblyRest.Channels channels
public AblyRest(java.lang.String key)
throws AblyException
key; - String key (obtained from application dashboard)AblyExceptionpublic AblyRest(ClientOptions options) throws AblyException
options: - see ClientOptions for optionsAblyExceptionpublic long time()
throws AblyException
AblyExceptionpublic void timeAsync(Callback<java.lang.Long> callback)
callback - public PaginatedResult<Stats> stats(Param[] params) throws AblyException
params - query options: see Ably REST API documentation
for available optionsAblyExceptionpublic void statsAsync(Param[] params, Callback<AsyncPaginatedResult<Stats>> callback)
params: - the request params. See the Ably REST APIcallback - public HttpPaginatedResponse request(java.lang.String method, java.lang.String path, Param[] params, HttpCore.RequestBody body, Param[] headers) throws AblyException
method: - the HTTP method to use (see constants in io.ably.lib.httpCore.HttpCore)path: - the path component of the resource URIparams - (optional; may be null): any parameters to send with the request; see API-specific documentationbody - (optional; may be null): an instance of RequestBody; either a JSONRequestBody or ByteArrayRequestBodyheaders - (optional; may be null): any additional headers to send; see API-specific documentationAblyException - if it was not possible to complete the request, or an error response was receivedpublic void requestAsync(java.lang.String method,
java.lang.String path,
Param[] params,
HttpCore.RequestBody body,
Param[] headers,
AsyncHttpPaginatedResponse.Callback callback)
method: - the HTTP method to use (see constants in io.ably.lib.httpCore.HttpCore)path: - the path component of the resource URIparams - (optional; may be null): any parameters to send with the request; see API-specific documentationbody - (optional; may be null): an instance of RequestBody; either a JSONRequestBody or ByteArrayRequestBodyheaders - (optional; may be null): any additional headers to send; see API-specific documentationcallback: - called with the asynchronous result@Experimental public PublishResponse[] publishBatch(Message.Batch[] pubSpecs, ChannelOptions channelOptions) throws AblyException
AblyException@Experimental public void publishBatchAsync(Message.Batch[] pubSpecs, ChannelOptions channelOptions, Callback<PublishResponse[]> callback) throws AblyException
AblyExceptionprotected void onAuthUpdated(java.lang.String token,
boolean waitForResponse)
throws AblyException
token - new tokenwaitForResponse - wait for server response before returning from methodAblyExceptionprotected void onAuthError(ErrorInfo errorInfo)