pub trait WSServerSocket<ClientMsg: Serialize + for<'a> Deserialize<'a> + Send, ServerMsg: Serialize + Debug + for<'a> Deserialize<'a> + Send>:
Sized
+ Sync
+ 'static {
const TIMEOUT: f32 = 10f32;
// Required methods
fn new(
socket: WSSocket<ClientMsg, ServerMsg>,
) -> impl Future<Output = Self> + Send;
fn handle(&self, msg: ClientMsg) -> impl Future<Output = bool> + Send;
fn span(&self) -> Option<&'static Span>;
// Provided methods
fn allow_user(state: LoginState) -> bool { ... }
async fn handler(
auth_session: AuthSession<DBBackend>,
ws: WebSocketUpgrade,
) -> Response
where Self: Send { ... }
}Available on crate feature
ssr only.Provided Associated Constants§
Required Methods§
fn new( socket: WSSocket<ClientMsg, ServerMsg>, ) -> impl Future<Output = Self> + Send
fn handle(&self, msg: ClientMsg) -> impl Future<Output = bool> + Send
fn span(&self) -> Option<&'static Span>
Provided Methods§
fn allow_user(state: LoginState) -> bool
async fn handler(
auth_session: AuthSession<DBBackend>,
ws: WebSocketUpgrade,
) -> Responsewhere
Self: Send,
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.