Struct ably::options::ClientOptions
source · pub struct ClientOptions { /* private fields */ }
Expand description
Ably client options for initialising a REST or Realtime client.
Implementations
sourceimpl ClientOptions
impl ClientOptions
pub fn new(s: &str) -> Self
pub fn with_auth_url(url: Url) -> Self
pub fn with_auth_callback(callback: Arc<dyn AuthCallback>) -> Self
pub fn with_token(token: String) -> Self
sourcepub fn client_id(self, client_id: impl Into<String>) -> Result<Self>
pub fn client_id(self, client_id: impl Into<String>) -> Result<Self>
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 ‘*’.
sourcepub fn use_token_auth(self, v: bool) -> Self
pub fn use_token_auth(self, v: bool) -> Self
Indicates whether token authentication should be used even if an API key is present.
sourcepub fn environment(self, environment: impl Into<String>) -> Result<Self>
pub fn environment(self, environment: impl Into<String>) -> Result<Self>
sourcepub fn use_binary_protocol(self, v: bool) -> Self
pub fn use_binary_protocol(self, v: bool) -> Self
Sets the message format to MessagePack if the argument is true, or JSON if the argument is false.
sourcepub fn default_token_params(self, params: TokenParams) -> Self
pub fn default_token_params(self, params: TokenParams) -> Self
Set the default TokenParams.
sourcepub fn fallback_hosts(self, hosts: Vec<String>) -> Self
pub fn fallback_hosts(self, hosts: Vec<String>) -> Self
Sets the fallback hosts.
sourcepub fn http_request_timeout(self, timeout: Duration) -> Self
pub fn http_request_timeout(self, timeout: Duration) -> Self
Sets the HTTP request timeout.
sourcepub fn http_max_retry_count(self, count: usize) -> Self
pub fn http_max_retry_count(self, count: usize) -> Self
Sets the maximum number of HTTP retries.
sourcepub fn rest(self) -> Result<Rest>
pub fn rest(self) -> Result<Rest>
Returns a Rest client using the ClientOptions.
Errors
This method fails if the ClientOptions are not valid:
- the REST API URL must be valid
pub fn token_source(token: Credential) -> Self
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for ClientOptions
impl Send for ClientOptions
impl Sync for ClientOptions
impl Unpin for ClientOptions
impl !UnwindSafe for ClientOptions
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more