pub struct WebSocketConnection { /* private fields */ }Expand description
WebSocket connection adapter bridging wire frames and EventSource/EventSink traits.
Implementations§
Source§impl WebSocketConnection
impl WebSocketConnection
pub fn session(&self) -> &WebSocketSessionContext
pub async fn send(&self, event: WebSocketEvent) -> Result<(), WebSocketError>
pub async fn send_json<T>(&self, value: &T) -> Result<(), WebSocketError>where
T: Serialize,
pub async fn next_json<T>(&mut self) -> Result<Option<T>, WebSocketError>where
T: DeserializeOwned,
Trait Implementations§
Source§impl EventSink<String> for WebSocketConnection
impl EventSink<String> for WebSocketConnection
Source§impl EventSink<WebSocketEvent> for WebSocketConnection
impl EventSink<WebSocketEvent> for WebSocketConnection
type Error = WebSocketError
Source§impl EventSource<WebSocketEvent> for WebSocketConnection
impl EventSource<WebSocketEvent> for WebSocketConnection
Source§fn next_event<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Option<WebSocketEvent>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn next_event<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Option<WebSocketEvent>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Returns the next event, or None if the source is exhausted/closed.
Auto Trait Implementations§
impl !Freeze for WebSocketConnection
impl !RefUnwindSafe for WebSocketConnection
impl Send for WebSocketConnection
impl Sync for WebSocketConnection
impl Unpin for WebSocketConnection
impl UnsafeUnpin for WebSocketConnection
impl !UnwindSafe for WebSocketConnection
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