Struct backtalk::Sender
[−]
[src]
pub struct Sender { /* fields omitted */ }
Sends JSON objects over a realtime stream to a single connected client
You almost certainly will only use a Sender
inside of a Channel
.
Methods
impl Sender
[src]
fn send<S: Into<String>>(
&mut self,
event_type: S,
val: JsonObject
) -> Result<(), ()>
&mut self,
event_type: S,
val: JsonObject
) -> Result<(), ()>
Sends the object val
to the client connected to this Sender
.
event_type
is some sort of event type, like "post"
or "delete"
, but it can be whatever
you'd like. The Result
returned is Ok(())
if the send was successful, and Err(())
if the
send was a failure. Note that this function returns instantly; the messages are queued in memory
before being sent out to the client.