pub struct FakeConn { /* private fields */ }Expand description
The server’s end of one connection. Like Rails it keeps the identifiers it has confirmed and ignores a second subscribe for one of them, so a test reads off the wire exactly what a Rails server would act on, in the order the test acts on it.
Implementations§
Source§impl FakeConn
impl FakeConn
Sourcepub async fn confirm(&self, identifier: &str)
pub async fn confirm(&self, identifier: &str)
Confirms a subscription, and remembers it the way Rails does.
Sourcepub async fn reject(&self, identifier: &str)
pub async fn reject(&self, identifier: &str)
Turns a subscription down, which also forgets it: the client is free to try again.
Sourcepub async fn broadcast(&self, identifier: &str, message: &str)
pub async fn broadcast(&self, identifier: &str, message: &str)
Plays a channel message to the client, as the server broadcasts one to identifier.
Sourcepub fn fail_writes(&self)
pub fn fail_writes(&self)
Every write from now on fails, the way a socket the peer has stopped reading does once the write timeout passes.
Sourcepub async fn writing(&self, count: usize)
pub async fn writing(&self, count: usize)
Waits until count writes have begun. With a write buffer smaller than that, the
last of them is still waiting for the test to read what came before it.
Sourcepub async fn sent(&self) -> Vec<u8> ⓘ
pub async fn sent(&self) -> Vec<u8> ⓘ
The next payload the client wrote that the server acts on, exactly as it went out.
Sourcepub async fn command(&self) -> SentCommand
pub async fn command(&self) -> SentCommand
The next command the client sent, decoded.
Sourcepub async fn expect_command(&self, name: &str, identifier: &str) -> SentCommand
pub async fn expect_command(&self, name: &str, identifier: &str) -> SentCommand
The next command, which has to be the one named. Taking a subscribe is not
answering it: until confirm, the server is as good as having
dropped it on the floor and the client’s guarantor will send it again.
Sourcepub async fn expect_silence(&self)
pub async fn expect_silence(&self)
Fails when the client sends anything in the next little while.