pub struct ClientHook { /* private fields */ }Expand description
Client-side authentication connection hook that sends a token to the server.
When connecting to a server, this connection hook:
- Sends the configured token to the server
- Waits for the server’s ACK response
- Returns an error if the server rejects the token
§Example
use bytes::Bytes;
use msg_socket::hooks::token::ClientHook;
let hook = ClientHook::new(Bytes::from("my_secret_token"));Implementations§
Trait Implementations§
Source§impl<Io> ConnectionHook<Io> for ClientHook
impl<Io> ConnectionHook<Io> for ClientHook
Source§type Error = ClientHookError
type Error = ClientHookError
The hook-specific error type.
Source§async fn on_connection(&self, io: Io) -> HookResult<Io, Self::Error>
async fn on_connection(&self, io: Io) -> HookResult<Io, Self::Error>
Called when a connection is established. Read more
Auto Trait Implementations§
impl !Freeze for ClientHook
impl RefUnwindSafe for ClientHook
impl Send for ClientHook
impl Sync for ClientHook
impl Unpin for ClientHook
impl UnsafeUnpin for ClientHook
impl UnwindSafe for ClientHook
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