pub struct SignalingServerBuilder<Topology, Cb = NoCallbacks, S = NoState>{ /* private fields */ }
Expand description
Builder for SignalingServer
s.
Begin with SignalingServerBuilder::new
and add parameters before calling
SignalingServerBuilder::build
to produce the desired SignalingServer
.
Implementations§
source§impl<Topology, Cb, S> SignalingServerBuilder<Topology, Cb, S>
impl<Topology, Cb, S> SignalingServerBuilder<Topology, Cb, S>
sourcepub fn new(
socket_addr: impl Into<SocketAddr>,
topology: Topology,
state: S
) -> Self
pub fn new( socket_addr: impl Into<SocketAddr>, topology: Topology, state: S ) -> Self
Creates a new builder for a SignalingServer
.
sourcepub fn mutate_router(self, alter: impl FnMut(Router) -> Router) -> Self
pub fn mutate_router(self, alter: impl FnMut(Router) -> Router) -> Self
Modify the router with a mutable closure. This is where one may apply middleware or other layers to the Router.
sourcepub fn on_connection_request<F>(self, callback: F) -> Self
pub fn on_connection_request<F>(self, callback: F) -> Self
Set a callback triggered before websocket upgrade to determine if the connection is allowed.
sourcepub fn on_id_assignment<F>(self, callback: F) -> Self
pub fn on_id_assignment<F>(self, callback: F) -> Self
Set a callback triggered when a socket has been assigned an ID. This happens after a connection is allowed, right before finalizing the websocket upgrade.
sourcepub fn build(self) -> SignalingServer
pub fn build(self) -> SignalingServer
Create a SignalingServer
.
source§impl SignalingServerBuilder<ClientServer, ClientServerCallbacks, ClientServerState>
impl SignalingServerBuilder<ClientServer, ClientServerCallbacks, ClientServerState>
sourcepub fn on_client_connected<F>(self, callback: F) -> Self
pub fn on_client_connected<F>(self, callback: F) -> Self
Set a callback triggered on all client websocket connections.
sourcepub fn on_client_disconnected<F>(self, callback: F) -> Self
pub fn on_client_disconnected<F>(self, callback: F) -> Self
Set a callback triggered on all client websocket disconnections.
sourcepub fn on_host_connected<F>(self, callback: F) -> Self
pub fn on_host_connected<F>(self, callback: F) -> Self
Set a callback triggered on host websocket connection.
source§impl SignalingServerBuilder<FullMesh, FullMeshCallbacks, FullMeshState>
impl SignalingServerBuilder<FullMesh, FullMeshCallbacks, FullMeshState>
sourcepub fn on_peer_connected<F>(self, callback: F) -> Self
pub fn on_peer_connected<F>(self, callback: F) -> Self
Set a callback triggered on all websocket connections.