pub struct Connection { /* private fields */ }Expand description
Low-level WebSocket connection handle.
Wraps a split tokio-tungstenite stream (sink + source) and provides
simple send/recv methods for raw frames. This type is not meant to
be used directly by application code — the session layer manages it.
Implementations§
Source§impl Connection
impl Connection
Sourcepub async fn connect(config: &TransportConfig) -> Result<Self, ConnectError>
pub async fn connect(config: &TransportConfig) -> Result<Self, ConnectError>
Establish a WebSocket connection (does not send the setup message).
Sourcepub async fn send_text(&mut self, json: &str) -> Result<(), SendError>
pub async fn send_text(&mut self, json: &str) -> Result<(), SendError>
Send a text frame (typically a serialised JSON message).
Auto Trait Implementations§
impl !Freeze for Connection
impl !RefUnwindSafe for Connection
impl Send for Connection
impl Sync for Connection
impl Unpin for Connection
impl UnsafeUnpin for Connection
impl !UnwindSafe for Connection
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