tide_compressed_sse 4.0.1

Async Server Sent Event parser and encoder
Documentation
/// An SSE message sender.
#[derive(Debug)]
pub struct Sender {
    sender: crate::encoder::Sender,
}

impl Sender {
    /// Create a new instance of `Sender`.
    pub(crate) fn new(sender: crate::encoder::Sender) -> Self {
        Self { sender }
    }

    /// Send data from the SSE channel.
    ///
    /// Each message consists of a "name" and "data".
    pub async fn send(
        &self,
        name: &str,
        data: impl AsRef<str>,
        id: Option<&str>,
    ) -> async_std::io::Result<()> {
        self.sender.send(name, data.as_ref(), id).await
    }
}