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

source

pub async fn connect( self, auth: Auth ) -> Result<Connection, WebsocketConnectionError>

Build the websocket connection from the set options and connect to the socket.

source

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

source

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.

source

pub fn outgoing_capacity(self, value: usize) -> Self

Number of messages to buffer before sending messages blocks the sender.

This defaults to 100

source

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.

source

pub fn ping_interval(self, value: Duration) -> Self

Number of seconds between each socket ping

This defaults to 30 seconds.

source

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.

Trait Implementations§

source§

impl Debug for ConnectionBuilder

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for ConnectionBuilder

source§

fn default() -> ConnectionBuilder

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

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

fn in_current_span(self) -> Instrumented<Self>

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

impl<T, U> Into<U> for Twhere U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

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

source§

impl<T> Same<T> for T

§

type Output = T

Should always be Self
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more