21 releases (13 breaking)

0.15.1 Oct 7, 2025
0.15.0 Mar 27, 2025
0.14.0 Feb 24, 2025
0.13.0 Jul 30, 2024
0.2.0 Jul 24, 2019

#41 in HTTP client

Download history 82270/week @ 2025-08-07 81752/week @ 2025-08-14 89944/week @ 2025-08-21 93694/week @ 2025-08-28 112766/week @ 2025-09-04 99039/week @ 2025-09-11 94522/week @ 2025-09-18 66276/week @ 2025-09-25 61057/week @ 2025-10-02 55316/week @ 2025-10-09 57090/week @ 2025-10-16 44264/week @ 2025-10-23 44707/week @ 2025-10-30 34563/week @ 2025-11-06 35686/week @ 2025-11-13 38677/week @ 2025-11-20

161,620 downloads per month
Used in 56 crates (25 directly)

Apache-2.0

300KB
1.5K SLoC

eventsource-client

Run CI

Client for the Server-Sent Events protocol (aka EventSource).

Requirements

Requires tokio.

Usage

Example that just prints the type of each event received:

use eventsource_client as es;

let mut client = es::ClientBuilder::for_url("https://example.com/stream")?
    .header("Authorization", "Basic username:password")?
    .build();

client
    .stream()
    .map_ok(|event| println!("got event: {:?}", event))
    .map_err(|err| eprintln!("error streaming events: {:?}", err));

(Some boilerplate omitted for clarity; see examples directory for complete, working code.)

Features

  • tokio-based streaming client.
  • Supports setting custom headers on the HTTP request (e.g. for endpoints requiring authorization).
  • Retry for failed connections.
  • Reconnection if connection is interrupted, with exponential backoff.

Stability

Early stage release for feedback purposes. May contain bugs or performance issues. API subject to change.

Dependencies

~5–18MB
~222K SLoC