#server-sent-events #endpoint #client-events

eventsource

Library for accessing EventSource/Server-Sent Events endpoints

5 releases (breaking)

0.5.0 Apr 22, 2020
0.4.0 Sep 15, 2019
0.3.0 Nov 4, 2017
0.2.0 Feb 9, 2017
0.1.0 May 27, 2016

#580 in HTTP client

Download history 255/week @ 2025-08-26 238/week @ 2025-09-02 169/week @ 2025-09-09 249/week @ 2025-09-16 151/week @ 2025-09-23 64/week @ 2025-09-30 74/week @ 2025-10-07 80/week @ 2025-10-14 84/week @ 2025-10-21 83/week @ 2025-10-28 75/week @ 2025-11-04 75/week @ 2025-11-11 105/week @ 2025-11-18 103/week @ 2025-11-25 82/week @ 2025-12-02 210/week @ 2025-12-09

528 downloads per month

MIT license

17KB
241 lines

EventSource

crates.io Documentation Build Status

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

Examples

use eventsource::reqwest::Client;
use reqwest::Url;
                                                                                              
fn main() {
    let client = Client::new(Url::parse("http://example.com").unwrap());
    for event in client {
        println!("{}", event.unwrap());
    }
}

Dependencies

~2.3–8.5MB
~156K SLoC