pub struct WscallServer { /* private fields */ }Expand description
Main server type used to register routes, filters, and event handlers.
Implementations§
Source§impl WscallServer
impl WscallServer
pub fn new() -> Self
pub fn with_chacha20_key(self, key: [u8; 32]) -> Self
pub fn with_aes256_key(self, key: [u8; 32]) -> Self
pub fn handle(&self) -> ServerHandle
pub fn route<F, Fut>(&mut self, route: impl Into<String>, handler: F)
pub fn typed_route<T, F, Fut>(&mut self, route: impl Into<String>, handler: F)
pub fn validated_route<T, F, Fut>( &mut self, route: impl Into<String>, handler: F, )
pub fn filter<F, Fut>(&mut self, filter: F)where
F: Fn(ApiContext) -> Fut + Send + Sync + 'static,
Fut: Future<Output = Result<ApiContext, ApiError>> + Send + 'static,
pub fn event_handler<F, Fut>(&mut self, name: impl Into<String>, handler: F)
pub fn on_connected<F, Fut>(&mut self, handler: F)
pub fn on_disconnected<F, Fut>(&mut self, handler: F)
pub fn exception_handler<F, Fut>(&mut self, handler: F)where
F: Fn(ExceptionContext) -> Fut + Send + Sync + 'static,
Fut: Future<Output = ErrorPayload> + Send + 'static,
pub async fn listen(self, address: &str) -> Result<(), ServerError>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for WscallServer
impl !RefUnwindSafe for WscallServer
impl Send for WscallServer
impl Sync for WscallServer
impl Unpin for WscallServer
impl UnsafeUnpin for WscallServer
impl !UnwindSafe for WscallServer
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