pub struct WebSocketTransport { /* private fields */ }Implementations§
Source§impl WebSocketTransport
impl WebSocketTransport
pub fn new(stream: WebSocketStream<MaybeTlsStream<TcpStream>>) -> Self
Sourcepub fn from_tcp_stream(stream: WebSocketStream<TcpStream>) -> Self
pub fn from_tcp_stream(stream: WebSocketStream<TcpStream>) -> Self
从 WebSocketStream<TcpStream> 创建(在没有 TLS 时使用)
使用单独的 Plain 类型,避免 unsafe transmute
Trait Implementations§
Source§impl Connection for WebSocketTransport
impl Connection for WebSocketTransport
Source§fn add_observer(&mut self, observer: ArcObserver)
fn add_observer(&mut self, observer: ArcObserver)
Adds an observer to the connection. Read more
Source§fn remove_observer(&mut self, observer: ArcObserver)
fn remove_observer(&mut self, observer: ArcObserver)
Removes an observer from the connection.
Source§fn send<'life0, 'life1, 'async_trait>(
&'life0 mut self,
data: &'life1 [u8],
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn send<'life0, 'life1, 'async_trait>(
&'life0 mut self,
data: &'life1 [u8],
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Sends data over the connection.
Source§fn close<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn close<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Closes the connection.
Source§fn last_active_time(&self) -> Instant
fn last_active_time(&self) -> Instant
Returns last activity time (send/receive). Used for heartbeat and idle detection.
Source§fn update_active_time(&mut self)
fn update_active_time(&mut self)
Updates last activity time (also called automatically on send/receive in most impls).
Auto Trait Implementations§
impl !RefUnwindSafe for WebSocketTransport
impl !UnwindSafe for WebSocketTransport
impl Freeze for WebSocketTransport
impl Send for WebSocketTransport
impl Sync for WebSocketTransport
impl Unpin for WebSocketTransport
impl UnsafeUnpin for WebSocketTransport
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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