pub struct WebSocketMonitor { /* private fields */ }Expand description
WebSocket monitor for tracking connections
Implementations§
Source§impl WebSocketMonitor
impl WebSocketMonitor
Sourcepub fn mock(&mut self, mock: WebSocketMock)
pub fn mock(&mut self, mock: WebSocketMock)
Add a mock rule
Sourcepub fn disconnect(&mut self, connection_id: &str, code: u16, reason: &str)
pub fn disconnect(&mut self, connection_id: &str, code: u16, reason: &str)
Close a connection
Sourcepub fn take_pending_responses(&mut self) -> Vec<(String, MockWebSocketResponse)>
pub fn take_pending_responses(&mut self) -> Vec<(String, MockWebSocketResponse)>
Get pending mock responses
Sourcepub fn connections(&self) -> Vec<String>
pub fn connections(&self) -> Vec<String>
Get all connections
Sourcepub fn get_connection(
&self,
connection_id: &str,
) -> Option<Vec<WebSocketMessage>>
pub fn get_connection( &self, connection_id: &str, ) -> Option<Vec<WebSocketMessage>>
Get connection by ID
Sourcepub fn all_messages(&self) -> Vec<WebSocketMessage>
pub fn all_messages(&self) -> Vec<WebSocketMessage>
Get all messages across all connections
Sourcepub fn connection_count(&self) -> usize
pub fn connection_count(&self) -> usize
Get connection count
Sourcepub fn active_connection_count(&self) -> usize
pub fn active_connection_count(&self) -> usize
Get active connection count
Sourcepub fn assert_sent(&self, pattern: &str) -> ProbarResult<()>
pub fn assert_sent(&self, pattern: &str) -> ProbarResult<()>
Assert a message was sent
Sourcepub fn assert_received(&self, pattern: &str) -> ProbarResult<()>
pub fn assert_received(&self, pattern: &str) -> ProbarResult<()>
Assert a message was received
Sourcepub fn assert_connected(&self, url_pattern: &str) -> ProbarResult<()>
pub fn assert_connected(&self, url_pattern: &str) -> ProbarResult<()>
Assert connection was made to URL
Trait Implementations§
Source§impl Debug for WebSocketMonitor
impl Debug for WebSocketMonitor
Auto Trait Implementations§
impl Freeze for WebSocketMonitor
impl RefUnwindSafe for WebSocketMonitor
impl Send for WebSocketMonitor
impl Sync for WebSocketMonitor
impl Unpin for WebSocketMonitor
impl UnsafeUnpin for WebSocketMonitor
impl UnwindSafe for WebSocketMonitor
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