Struct ratchet_rs::WebSocketServerBuilder
source · [−]pub struct WebSocketServerBuilder<E> { /* private fields */ }
Expand description
A builder to construct WebSocket servers.
If a lot of connections will be negotiated it is more efficient to directly use accept_with
than this builder as it is possible for accept_with
to borrow the extension provider and
protocol registry.
Implementations
sourceimpl<E> WebSocketServerBuilder<E>
impl<E> WebSocketServerBuilder<E>
sourcepub async fn accept<S>(
self,
stream: S
) -> Result<UpgradedServer<S, <E as ExtensionProvider>::Extension>, Error> where
S: WebSocketStream,
E: ExtensionProvider,
pub async fn accept<S>(
self,
stream: S
) -> Result<UpgradedServer<S, <E as ExtensionProvider>::Extension>, Error> where
S: WebSocketStream,
E: ExtensionProvider,
Accept stream
and perform a server WebSocket handshake.
sourcepub fn config(self, config: WebSocketConfig) -> WebSocketServerBuilder<E>
pub fn config(self, config: WebSocketConfig) -> WebSocketServerBuilder<E>
Sets the configuration that will be used for the connection.
sourcepub fn extension<T>(self, extension: T) -> WebSocketServerBuilder<T> where
T: ExtensionProvider,
pub fn extension<T>(self, extension: T) -> WebSocketServerBuilder<T> where
T: ExtensionProvider,
Sets the extension that will be used for the connection.
sourcepub fn subprotocols<I>(
self,
subprotocols: I
) -> Result<WebSocketServerBuilder<E>, Error> where
I: IntoIterator,
<I as IntoIterator>::Item: Into<Cow<'static, str>>,
pub fn subprotocols<I>(
self,
subprotocols: I
) -> Result<WebSocketServerBuilder<E>, Error> where
I: IntoIterator,
<I as IntoIterator>::Item: Into<Cow<'static, str>>,
Sets the subprotocols that will be used for the connection.
Trait Implementations
sourceimpl<E> Debug for WebSocketServerBuilder<E> where
E: Debug,
impl<E> Debug for WebSocketServerBuilder<E> where
E: Debug,
sourceimpl Default for WebSocketServerBuilder<NoExtProvider>
impl Default for WebSocketServerBuilder<NoExtProvider>
sourcefn default() -> WebSocketServerBuilder<NoExtProvider>
fn default() -> WebSocketServerBuilder<NoExtProvider>
Returns the “default value” for a type. Read more
Auto Trait Implementations
impl<E> RefUnwindSafe for WebSocketServerBuilder<E> where
E: RefUnwindSafe,
impl<E> Send for WebSocketServerBuilder<E> where
E: Send,
impl<E> Sync for WebSocketServerBuilder<E> where
E: Sync,
impl<E> Unpin for WebSocketServerBuilder<E> where
E: Unpin,
impl<E> UnwindSafe for WebSocketServerBuilder<E> where
E: UnwindSafe,
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