pub struct SoeHandle { /* private fields */ }Expand description
A cloneable handle for interacting with a TokioSoeServer from any task.
All methods are non-blocking: they post a command to the server’s driver loop,
which owns the socket and the SoeMultiplexer. This lets per-client game-logic
tasks send reliable data and manage sessions without sharing the (necessarily
single-owner) protocol state.
Each method returns false if the server’s driver loop has stopped (e.g. the
TokioSoeServer was dropped), in which case the command was not delivered.
Implementations§
Source§impl SoeHandle
impl SoeHandle
Sourcepub fn connect(&self, remote: SocketAddr) -> bool
pub fn connect(&self, remote: SocketAddr) -> bool
Opens a client session to remote. The session request is sent by the driver
loop on its next cycle.
Sourcepub fn enqueue_data(&self, remote: SocketAddr, data: impl Into<Bytes>) -> bool
pub fn enqueue_data(&self, remote: SocketAddr, data: impl Into<Bytes>) -> bool
Enqueues application data to be sent reliably to remote.
Returns false only if the driver loop has stopped; it does not report
whether a session for remote exists (that is determined asynchronously by
the loop).
Sourcepub fn terminate(&self, remote: SocketAddr, reason: DisconnectReason) -> bool
pub fn terminate(&self, remote: SocketAddr, reason: DisconnectReason) -> bool
Terminates the session with remote, notifying the remote party.