Skip to content

Add SSE live notifications and Rust SDK subscriber#96

Merged
digizeph merged 1 commit intomainfrom
dev/add-sse-stream-support
Mar 15, 2026
Merged

Add SSE live notifications and Rust SDK subscriber#96
digizeph merged 1 commit intomainfrom
dev/add-sse-stream-support

Conversation

@digizeph
Copy link
Copy Markdown
Member

Summary

  • Add live SSE notifications at GET {root}/events.
  • Add an optional Rust SDK SSE subscriber with client-side filtering.
  • Update the public documentation for the new API and feature flag.

Changes

  • Wire SSE events to newly inserted BrokerItem records in the serve updater process.
  • Return 503 from /events when the updater is disabled in the current process.
  • Add the sse feature, SseSubscriptionOptions, BrokerItemSubscription, and BgpkitBroker::subscribe_new_files().
  • Parse SSE frames in the SDK and filter them client-side by project, collector_id, and data_type.
  • Update the changelog and README entries for the endpoint and SDK usage.

Example

curl -N http://127.0.0.1:40064/events
use bgpkit_broker::{BgpkitBroker, SseSubscriptionOptions};
use futures_util::StreamExt;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let broker = BgpkitBroker::new()
        .broker_url("http://127.0.0.1:40064/v3/broker");

    let options = SseSubscriptionOptions::new()
        .project("routeviews")
        .collector_id("route-views2")
        .data_type("updates");

    let mut subscription = broker.subscribe_new_files(options).await?;

    while let Some(item) = subscription.next().await {
        println!("{}", item?.url);
    }

    Ok(())
}

@digizeph digizeph merged commit 12fac61 into main Mar 15, 2026
1 check passed
@digizeph digizeph deleted the dev/add-sse-stream-support branch March 15, 2026 21:47
@digizeph digizeph mentioned this pull request Mar 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant