Struct ably::options::ClientOptions

source ·
pub struct ClientOptions { /* private fields */ }
Expand description

Ably client options for initialising a REST or Realtime client.

Implementations

Sets the API key.

Example
let client = ably::ClientOptions::new("aaaaaa.bbbbbb:cccccc").rest()?;

Set the client ID, used for identifying this client when publishing messages or for presence purposes. Can be any utf-8 string except the reserved wildcard string ‘*’.

Indicates whether token authentication should be used even if an API key is present.

Sets the environment. See [TO3k1].

Example
let client = ably::ClientOptions::new("aaaaaa.bbbbbb:cccccc")
    .environment("sandbox")?
    .rest()?;
Errors

Fails if rest_host is already set or if the environment cannot be used in the REST API URL.

Sets the message format to MessagePack if the argument is true, or JSON if the argument is false.

Set the default TokenParams.

Sets the rest_host. See [TO3k2].

Example
let client = ably::ClientOptions::new("aaaaaa.bbbbbb:cccccc")
    .rest_host("sandbox-rest.ably.io")?
    .rest()?;
Errors

Fails if environment is already set or if the rest_host cannot be used in the REST API URL.

Sets the fallback hosts.

Sets the HTTP request timeout.

Sets the maximum number of HTTP retries.

Returns a Rest client using the ClientOptions.

Errors

This method fails if the ClientOptions are not valid:

  • the REST API URL must be valid

Trait Implementations

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Should always be Self
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more