Struct backtalk::memory::MemoryChannel
[−]
[src]
pub struct MemoryChannel { /* fields omitted */ }
Methods
impl MemoryChannel
[src]
fn new() -> MemoryChannel
Trait Implementations
impl Channel for MemoryChannel
[src]
fn join(&self, sender: Sender, _: Option<String>, _: JsonObject)
Called when a new streamed reply is created in the handle
function. The Sender
is the object representing the connected client — you can call sender.send
to send messages to this client. The Option<String>
is the ID in the URL — for instance, a subscription to /cats
would have an ID of None
, and a subscription to /cats/123
would have an ID of Some("123")
. The JsonObject
is the params object of the request, and can be used for authenticating users. Read more
fn send(&self, message_kind: &str, msg: &JsonObject)
Called by application code to send a new message to connected clients. Channel implementors are also free to add additional functions that send messages with additional paramaters, such as specifying which users get notified. Read more
fn handle(&self, req: Request) -> BoxFuture<Reply, Error>
Takes a Request
and returns a Reply
future with a streaming Reply
body. If you're using a channel in your server's application code, this is the function you'll want to use. Read more