hyperlane-plugin-sse 23.3.2

A Server-Sent Events (SSE) streaming and topic pub/sub plugin for the Hyperlane framework with Last-Event-ID replay, heartbeat, and CRLF-safe event framing.
Documentation
use super::*;

/// Errors returned by [`crate::SseHub`], [`crate::SseSubscription`], and [`crate::SseStream`] operations.
#[derive(Clone, Debug, Eq, PartialEq)]
pub enum SseError {
    /// Creating a new topic would exceed `SseConfig::max_topics`.
    TopicLimitReached,
    /// The underlying topic broadcast channel has closed.
    ChannelClosed,
    /// The subscriber lagged behind the broadcast ring by `u64` messages.
    Lagged(u64),
    /// Writing an SSE frame to the HTTP response stream failed.
    Transport(String),
}

/// Next streaming action yielded to [`SseStream::serve_subscription`].
pub(crate) enum SseLoopAction {
    /// One shared SSE event ready to write and optionally coalesce with queued events.
    Event(Arc<SharedSseEvent>),
    /// Shared heartbeat bucket ticked and a keep-alive comment should be flushed.
    Heartbeat,
    /// The topic closed cleanly and the stream should finish.
    Closed,
}