Crate eventsource_threaded

Source
Expand description

§EventSource-Threaded

EventSource-Threaded is a Rust library for reading from Server-Sent Events endpoints. It transparently sends HTTP requests on a separate thread and only exposes a stream of events to the user via a channel receiver. It handles automatic reconnection and parsing of the text/event-stream data format.

§Examples

use eventsource-threaded::reqwest::Client;
use reqwest::Url;

fn main() {
    let receiver = EventSource::new(Url::parse("http://example.com").unwrap());
    loop {
        println!("Received Event: {:?}", receiver.recv());
    }
}

Re-exports§

pub use eventsource::EventSource;
pub use eventsource::ReceiverSource;

Modules§

event
eventsource