Struct glimesh::ws::ConnectionBuilder
source · pub struct ConnectionBuilder { /* private fields */ }
Expand description
Configure and build a websocket Connection
.
Usage:
let connection = Connection::builder()
.api_url("ws://localhost:8080/api/socket/websocket")
.build();
Implementations§
source§impl ConnectionBuilder
impl ConnectionBuilder
sourcepub async fn connect(
self,
auth: Auth
) -> Result<Connection, WebsocketConnectionError>
pub async fn connect( self, auth: Auth ) -> Result<Connection, WebsocketConnectionError>
Build the websocket connection from the set options and connect to the socket.
sourcepub fn api_url(self, value: impl Into<String>) -> Self
pub fn api_url(self, value: impl Into<String>) -> Self
Set the base api url used for request. Useful if running Glimesh locally for example.
Defaults to wss://glimesh.tv/api/socket/websocket
sourcepub fn version(self, value: impl Into<String>) -> Self
pub fn version(self, value: impl Into<String>) -> Self
Set the version passed as query param vsn
.
This defaults to 2.0.0
and is all glimesh supports at the time of writing.
sourcepub fn outgoing_capacity(self, value: usize) -> Self
pub fn outgoing_capacity(self, value: usize) -> Self
Number of messages to buffer before sending messages blocks the sender.
This defaults to 100
sourcepub fn incoming_capacity(self, value: usize) -> Self
pub fn incoming_capacity(self, value: usize) -> Self
Number of messages buffered before older messages a dropped if they aren’t being handled in time.
This defaults to 10_000 to allow for bursts of messages.
sourcepub fn ping_interval(self, value: Duration) -> Self
pub fn ping_interval(self, value: Duration) -> Self
Number of seconds between each socket ping
This defaults to 30 seconds.
sourcepub fn request_timeout(self, value: Duration) -> Self
pub fn request_timeout(self, value: Duration) -> Self
How long to wait for a response to a request over the socket before timing out.
This defaults to 30 seconds.