pub struct WsConn { /* private fields */ }Expand description
A per-connection WebSocket actor that bridges Gun protocol messages.
Created by crate::adapters::WsServer (inbound) or
crate::adapters::OutgoingWebsocketManager (outbound). Each WsConn
manages a single WebSocket connection and translates between the
Gun wire format (text) and [Message] enum values.
Implementations§
Source§impl WsConn
impl WsConn
Sourcepub fn new(
sender: SplitSink<WebSocketStream<MaybeTlsStream<TcpStream>>, Message>,
receiver: SplitStream<WebSocketStream<MaybeTlsStream<TcpStream>>>,
allow_public_space: bool,
) -> Self
pub fn new( sender: SplitSink<WebSocketStream<MaybeTlsStream<TcpStream>>, Message>, receiver: SplitStream<WebSocketStream<MaybeTlsStream<TcpStream>>>, allow_public_space: bool, ) -> Self
Creates a new WsConn from the split halves of a WebSocket stream.
§Arguments
sender- The writing half of the WebSocket streamreceiver- The reading half of the WebSocket streamallow_public_space- Whether to accept public space writes (forwarded toMessage::try_fromfor inbound message parsing)
Trait Implementations§
Source§impl Actor for WsConn
impl Actor for WsConn
Source§fn handle<'life0, 'life1, 'async_trait>(
&'life0 mut self,
msg: Message,
_ctx: &'life1 ActorContext,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn handle<'life0, 'life1, 'async_trait>(
&'life0 mut self,
msg: Message,
_ctx: &'life1 ActorContext,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Handle an incoming message.
Source§fn pre_start<'life0, 'life1, 'async_trait>(
&'life0 mut self,
ctx: &'life1 ActorContext,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn pre_start<'life0, 'life1, 'async_trait>(
&'life0 mut self,
ctx: &'life1 ActorContext,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Called once before the actor starts processing messages. Read more
Source§fn stopping<'life0, 'life1, 'async_trait>(
&'life0 mut self,
_context: &'life1 ActorContext,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn stopping<'life0, 'life1, 'async_trait>(
&'life0 mut self,
_context: &'life1 ActorContext,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Called once after the actor’s message loop exits. Read more
Source§fn subscribe_to_everything(&self) -> bool
fn subscribe_to_everything(&self) -> bool
Whether this actor wants to receive all messages (not just addressed
to it). Used by the Multicast adapter. Read more
Auto Trait Implementations§
impl !Freeze for WsConn
impl !RefUnwindSafe for WsConn
impl !UnwindSafe for WsConn
impl Send for WsConn
impl Sync for WsConn
impl Unpin for WsConn
impl UnsafeUnpin for WsConn
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