Struct matchbox_socket::WebRtcSocketBuilder
source · pub struct WebRtcSocketBuilder<C: ChannelPlurality = NoChannels> { /* private fields */ }
Expand description
Builder for WebRtcSocket
s.
Begin with WebRtcSocketBuilder::new
and add at least one channel with
WebRtcSocketBuilder::add_channel
before calling
WebRtcSocketBuilder::build
to produce the desired WebRtcSocket
.
Implementations§
source§impl WebRtcSocketBuilder
impl WebRtcSocketBuilder
sourcepub fn new(room_url: impl Into<String>) -> Self
pub fn new(room_url: impl Into<String>) -> Self
Creates a new builder for a connection to a given room with the default ICE server configuration, and three reconnection attempts.
You must add at least one channel with WebRtcSocketBuilder::add_channel
before you can build the WebRtcSocket
sourcepub fn ice_server(self, ice_server: RtcIceServerConfig) -> Self
pub fn ice_server(self, ice_server: RtcIceServerConfig) -> Self
Sets the socket ICE server configuration.
sourcepub fn reconnect_attempts(self, attempts: Option<u16>) -> Self
pub fn reconnect_attempts(self, attempts: Option<u16>) -> Self
Sets the number of attempts to make at reconnecting to the signaling server,
if None
the socket will attempt to connect indefinitely.
The default is 3 reconnection attempts.
sourcepub fn signaling_keep_alive_interval(self, interval: Option<Duration>) -> Self
pub fn signaling_keep_alive_interval(self, interval: Option<Duration>) -> Self
Sets the interval at which to send empty requests to the signaling server.
Some web services (like e.g. nginx as a reverse proxy) will close idle web sockets. Setting this interval will periodically send empty requests to let the signaling server know the client is still connected and prevent disconnections.
The defaults is 10 seconds.
source§impl WebRtcSocketBuilder<NoChannels>
impl WebRtcSocketBuilder<NoChannels>
sourcepub fn add_channel(
self,
config: ChannelConfig
) -> WebRtcSocketBuilder<SingleChannel>
pub fn add_channel( self, config: ChannelConfig ) -> WebRtcSocketBuilder<SingleChannel>
Adds a new channel to the WebRtcSocket
configuration according to a ChannelConfig
.
sourcepub fn add_unreliable_channel(self) -> WebRtcSocketBuilder<SingleChannel>
pub fn add_unreliable_channel(self) -> WebRtcSocketBuilder<SingleChannel>
Adds a new unreliable channel to the WebRtcSocket
configuration.
sourcepub fn add_reliable_channel(self) -> WebRtcSocketBuilder<SingleChannel>
pub fn add_reliable_channel(self) -> WebRtcSocketBuilder<SingleChannel>
Adds a new reliable channel to the WebRtcSocket
configuration.
source§impl WebRtcSocketBuilder<SingleChannel>
impl WebRtcSocketBuilder<SingleChannel>
sourcepub fn add_channel(
self,
config: ChannelConfig
) -> WebRtcSocketBuilder<MultipleChannels>
pub fn add_channel( self, config: ChannelConfig ) -> WebRtcSocketBuilder<MultipleChannels>
Adds a new channel to the WebRtcSocket
configuration according to a ChannelConfig
.
sourcepub fn add_unreliable_channel(self) -> WebRtcSocketBuilder<MultipleChannels>
pub fn add_unreliable_channel(self) -> WebRtcSocketBuilder<MultipleChannels>
Adds a new unreliable channel to the WebRtcSocket
configuration.
sourcepub fn add_reliable_channel(self) -> WebRtcSocketBuilder<MultipleChannels>
pub fn add_reliable_channel(self) -> WebRtcSocketBuilder<MultipleChannels>
Adds a new reliable channel to the WebRtcSocket
configuration.
source§impl WebRtcSocketBuilder<MultipleChannels>
impl WebRtcSocketBuilder<MultipleChannels>
sourcepub fn add_channel(
self,
config: ChannelConfig
) -> WebRtcSocketBuilder<MultipleChannels>
pub fn add_channel( self, config: ChannelConfig ) -> WebRtcSocketBuilder<MultipleChannels>
Adds a new channel to the WebRtcSocket
configuration according to a ChannelConfig
.
sourcepub fn add_unreliable_channel(self) -> WebRtcSocketBuilder<MultipleChannels>
pub fn add_unreliable_channel(self) -> WebRtcSocketBuilder<MultipleChannels>
Adds a new unreliable channel to the WebRtcSocket
configuration.
sourcepub fn add_reliable_channel(self) -> WebRtcSocketBuilder<MultipleChannels>
pub fn add_reliable_channel(self) -> WebRtcSocketBuilder<MultipleChannels>
Adds a new reliable channel to the WebRtcSocket
configuration.
source§impl<C: BuildablePlurality> WebRtcSocketBuilder<C>
impl<C: BuildablePlurality> WebRtcSocketBuilder<C>
sourcepub fn build(self) -> (WebRtcSocket<C>, MessageLoopFuture)
pub fn build(self) -> (WebRtcSocket<C>, MessageLoopFuture)
Creates a WebRtcSocket
and the corresponding MessageLoopFuture
according to the
configuration supplied.
The returned MessageLoopFuture
should be awaited in order for messages to be sent and
received.
Trait Implementations§
source§impl<C: Clone + ChannelPlurality> Clone for WebRtcSocketBuilder<C>
impl<C: Clone + ChannelPlurality> Clone for WebRtcSocketBuilder<C>
source§fn clone(&self) -> WebRtcSocketBuilder<C>
fn clone(&self) -> WebRtcSocketBuilder<C>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more