pub struct SocketHarness { /* private fields */ }Expand description
Runs a controller’s events against a container, with no server.
Implementations§
Source§impl SocketHarness
impl SocketHarness
pub fn new( registration: SocketControllerRegistration, container: Container, ) -> Self
pub fn namespace(&self) -> &str
Sourcepub fn event_names(&self) -> Vec<&'static str>
pub fn event_names(&self) -> Vec<&'static str>
Event names, in registration order.
Sourcepub fn handshake_names(&self) -> Vec<&'static str>
pub fn handshake_names(&self) -> Vec<&'static str>
Handshake middleware names, in the order they would run.
Sourcepub fn container(&self) -> &Container
pub fn container(&self) -> &Container
The container a connection’s events resolve from.
A real connection gets a child of it, populated by the handshake; register there what a middleware would have, and a handler sees the same thing it would in production.
Sourcepub async fn emit(&self, event: &str, payload: Value) -> EmittedEvent
pub async fn emit(&self, event: &str, payload: Value) -> EmittedEvent
Emit an event and capture what the client would have received.
§Panics
If no handler is registered for event — a test emitting an
event nothing handles is asserting nothing, and in production
that packet is silently dropped, which is worse to discover
later.
Auto Trait Implementations§
impl !RefUnwindSafe for SocketHarness
impl !UnwindSafe for SocketHarness
impl Freeze for SocketHarness
impl Send for SocketHarness
impl Sync for SocketHarness
impl Unpin for SocketHarness
impl UnsafeUnpin for SocketHarness
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