pub struct ProtocolClient { /* private fields */ }Expand description
WebSocket client for Sendspin protocol
Implementations§
Source§impl ProtocolClient
impl ProtocolClient
Sourcepub async fn disconnect(self, reason: GoodbyeReason) -> Result<(), Error>
pub async fn disconnect(self, reason: GoodbyeReason) -> Result<(), Error>
Gracefully disconnect: sends client/goodbye, closes the WebSocket,
and aborts background tasks.
Sourcepub async fn enter_external_source(&self) -> Result<(), Error>
pub async fn enter_external_source(&self) -> Result<(), Error>
Sourcepub async fn exit_external_source(
&self,
player: Option<PlayerState>,
) -> Result<(), Error>
pub async fn exit_external_source( &self, player: Option<PlayerState>, ) -> Result<(), Error>
Sourcepub fn clock_sync(&self) -> Arc<Mutex<ClockSync>>
pub fn clock_sync(&self) -> Arc<Mutex<ClockSync>>
Get reference to clock sync
Sourcepub fn server_hello(&self) -> &ServerHello
pub fn server_hello(&self) -> &ServerHello
The server/hello received during handshake. Carries server_id,
connection_reason, and active_roles — required for the
multi-server arbitration policy described on ProtocolListener.
Sourcepub fn split(self) -> Connection
pub fn split(self) -> Connection
Split into separate receivers for concurrent processing.
This allows using tokio::select! to process messages and binary
data concurrently. Use the fields you need; ignore the rest.
Auto Trait Implementations§
impl !RefUnwindSafe for ProtocolClient
impl !UnwindSafe for ProtocolClient
impl Freeze for ProtocolClient
impl Send for ProtocolClient
impl Sync for ProtocolClient
impl Unpin for ProtocolClient
impl UnsafeUnpin for ProtocolClient
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