Struct misskey_websocket::WebSocketClientBuilder
source · [−]pub struct WebSocketClientBuilder { /* private fields */ }Expand description
Builder for WebSocketClient.
Implementations
sourceimpl WebSocketClientBuilder
impl WebSocketClientBuilder
sourcepub fn new<T>(url: T) -> Self where
T: TryInto<Url>,
T::Error: Into<Error>,
pub fn new<T>(url: T) -> Self where
T: TryInto<Url>,
T::Error: Into<Error>,
Creates a new builder instance with url.
All configurations are set to default.
sourcepub fn with_host<S>(host: S) -> Self where
S: AsRef<str>,
pub fn with_host<S>(host: S) -> Self where
S: AsRef<str>,
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 where
S: AsRef<str>,
pub fn token<S>(&mut self, token: S) -> &mut Self where
S: AsRef<str>,
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 where
S1: AsRef<str>,
S2: AsRef<str>,
pub fn query<S1, S2>(&mut self, key: S1, value: S2) -> &mut Self where
S1: AsRef<str>,
S2: AsRef<str>,
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
sourceimpl Clone for WebSocketClientBuilder
impl Clone for WebSocketClientBuilder
sourcefn clone(&self) -> WebSocketClientBuilder
fn clone(&self) -> WebSocketClientBuilder
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source. Read more
Auto Trait Implementations
impl !RefUnwindSafe for WebSocketClientBuilder
impl Send for WebSocketClientBuilder
impl Sync for WebSocketClientBuilder
impl Unpin for WebSocketClientBuilder
impl !UnwindSafe for WebSocketClientBuilder
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
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
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into)Uses borrowed data to replace owned data, usually by cloning. Read more