pub struct WebsocketServer {
pub auth_controller: Arc<dyn AuthController>,
pub handlers: HashMap<u32, WsEndpoint>,
pub message_receiver: Option<Receiver<ConnectionId>>,
pub toolbox: ArcToolbox,
pub config: WsServerConfig,
}Fields§
§auth_controller: Arc<dyn AuthController>§handlers: HashMap<u32, WsEndpoint>§message_receiver: Option<Receiver<ConnectionId>>§toolbox: ArcToolbox§config: WsServerConfigImplementations§
Source§impl WebsocketServer
impl WebsocketServer
pub fn new(config: WsServerConfig) -> Self
pub fn set_auth_controller(&mut self, controller: impl AuthController + 'static)
pub fn add_handler<T: RequestHandler + 'static>(&mut self, handler: T)
pub fn add_handler_erased( &mut self, schema: EndpointSchema, handler: Arc<dyn RequestHandlerErased>, )
pub async fn handle_session_connection<S: AsyncRead + AsyncWrite + Unpin + Send + 'static>( self: Arc<Self>, conn: Arc<WsConnection>, states: Arc<WebsocketStates>, stream: WebSocketStream<S>, rx: Receiver<Message>, )
pub async fn listen(self) -> Result<()>
pub fn dump_schemas(&self) -> Result<()>
Auto Trait Implementations§
impl Freeze for WebsocketServer
impl !RefUnwindSafe for WebsocketServer
impl Send for WebsocketServer
impl Sync for WebsocketServer
impl Unpin for WebsocketServer
impl !UnwindSafe for WebsocketServer
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more