Struct websocket_server_async::Builder
source · [−]pub struct Builder<I, R, A, T> { /* private fields */ }
Expand description
websocket server builder
Implementations
sourceimpl<I, R, A, T> Builder<I, R, A, T>where
I: Fn(SplitStream<WebSocketStream<MaybeRustlsStream<TcpStream>>>, Arc<Actor<WSPeer>>, T) -> R + Send + Sync + 'static,
R: Future<Output = Result<()>> + Send + 'static,
A: ToSocketAddrs,
T: Clone + Send + 'static,
impl<I, R, A, T> Builder<I, R, A, T>where
I: Fn(SplitStream<WebSocketStream<MaybeRustlsStream<TcpStream>>>, Arc<Actor<WSPeer>>, T) -> R + Send + Sync + 'static,
R: Future<Output = Result<()>> + Send + 'static,
A: ToSocketAddrs,
T: Clone + Send + 'static,
pub fn new(addr: A) -> Builder<I, R, A, T>
sourcepub fn set_input_event(self, f: I) -> Self
pub fn set_input_event(self, f: I) -> Self
设置websocket server 输入事件
sourcepub fn set_connect_event(self, c: ConnectEventType) -> Self
pub fn set_connect_event(self, c: ConnectEventType) -> Self
设置TCP server 连接事件
sourcepub fn set_tls(self, tls: Option<TlsAcceptor>) -> Self
pub fn set_tls(self, tls: Option<TlsAcceptor>) -> Self
设置TCP server 连接事件
sourcepub fn set_config(self, config: WebSocketConfig) -> Self
pub fn set_config(self, config: WebSocketConfig) -> Self
设置config
sourcepub fn set_load_timeout(self, load_timeout_secs: u64) -> Self
pub fn set_load_timeout(self, load_timeout_secs: u64) -> Self
设置等待websocket hand accept 加载 等待时间
sourcepub async fn build(self) -> Arc<Actor<WebSocketServer<I, R, T>>>
pub async fn build(self) -> Arc<Actor<WebSocketServer<I, R, T>>>
生成TCPSERVER,如果没有设置 tcp input 将报错
Auto Trait Implementations
impl<I, R, A, T> !RefUnwindSafe for Builder<I, R, A, T>
impl<I, R, A, T> Send for Builder<I, R, A, T>where
A: Send,
I: Send,
R: Send,
T: Send,
impl<I, R, A, T> Sync for Builder<I, R, A, T>where
A: Sync,
I: Sync,
R: Sync,
T: Sync,
impl<I, R, A, T> Unpin for Builder<I, R, A, T>where
A: Unpin,
I: Unpin,
R: Unpin,
T: Unpin,
impl<I, R, A, T> !UnwindSafe for Builder<I, R, A, T>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
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