pub struct WebSocketClientBuilder { /* private fields */ }
Expand description
Builder for WebSocketClient
.
Implementations§
Source§impl WebSocketClientBuilder
impl WebSocketClientBuilder
Sourcepub fn new<T>(url: T) -> Self
pub fn new<T>(url: T) -> Self
Creates a new builder instance with url
.
All configurations are set to default.
Sourcepub fn with_host<S>(host: S) -> Self
pub fn with_host<S>(host: S) -> Self
Creates a new builder instance with the given host name host
.
This method configures the builder with a URL of the form wss://{host}/streaming
.
All other configurations are set to default.
Sourcepub fn token<S>(&mut self, token: S) -> &mut Self
pub fn token<S>(&mut self, token: S) -> &mut Self
Sets an API token.
This method appends the given token as the i
query parameter to the URL.
Sourcepub fn query<S1, S2>(&mut self, key: S1, value: S2) -> &mut Self
pub fn query<S1, S2>(&mut self, key: S1, value: S2) -> &mut Self
Specifies additional query parameters for the URL.
Sourcepub fn auto_reconnect(&mut self, enable: bool) -> &mut Self
pub fn auto_reconnect(&mut self, enable: bool) -> &mut Self
Sets whether or not to enable automatic reconnection.
Automatic reconnection is enabled by default (as per Default
implementation for
ReconnectConfig
), and you can disable it with .auto_reconnect(false)
.
Sourcepub fn reconnect_secs(&mut self, secs: u64) -> &mut Self
pub fn reconnect_secs(&mut self, secs: u64) -> &mut Self
Sets an interval duration of automatic reconnection in seconds.
Sourcepub fn reconnect_interval(&mut self, interval: Duration) -> &mut Self
pub fn reconnect_interval(&mut self, interval: Duration) -> &mut Self
Sets an interval duration of automatic reconnection.
Sourcepub fn reconnect_condition(
&mut self,
condition: ReconnectCondition,
) -> &mut Self
pub fn reconnect_condition( &mut self, condition: ReconnectCondition, ) -> &mut Self
Specifies the condition for reconnecting.
Sourcepub fn reconnect_retry_send(&mut self, enable: bool) -> &mut Self
pub fn reconnect_retry_send(&mut self, enable: bool) -> &mut Self
Specifies whether to re-send messages that may have failed to be sent when reconnecting.
Sourcepub async fn connect(&self) -> Result<WebSocketClient, Error>
pub async fn connect(&self) -> Result<WebSocketClient, Error>
Finish this builder instance and connect to Misskey using this configuration.
Trait Implementations§
Source§impl Clone for WebSocketClientBuilder
impl Clone for WebSocketClientBuilder
Source§fn clone(&self) -> WebSocketClientBuilder
fn clone(&self) -> WebSocketClientBuilder
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more