atproto-jetstream
WebSocket event stream consumer library for AT Protocol Jetstream.
Overview
atproto-jetstream provides a comprehensive async stream consumer for AT Protocol Jetstream events. This library enables real-time consumption of AT Protocol repository events, identity changes, and account updates through WebSocket connections with support for filtering, compression, and graceful shutdown patterns.
Binaries
- atproto-jetstream-consumer: Real-time event stream consumer with filtering and compression support
Features
- High-performance WebSocket streaming with automatic reconnection
- Flexible event handler system with multiple custom handlers
- Zstandard compression support with custom dictionaries
- Event filtering by collections and DIDs
- Graceful shutdown with cancellation token support
- Structured error handling with detailed error codes
Usage
Basic Event Consumer
use ;
use async_trait;
;
let config = ConsumerTaskConfig ;
let consumer = new;
consumer.register_handler.await?;
let cancellation_token = new;
consumer.run_background.await?;
With Compression
let config = ConsumerTaskConfig ;
// Download dictionary first:
// curl -o data/zstd_dictionary https://github.com/bluesky-social/jetstream/raw/refs/heads/main/pkg/models/zstd_dictionary
Command Line Examples
# Basic streaming
# With compression
# With filtering
License
MIT License