24 releases (14 breaking)

new 0.16.2 Feb 11, 2026
0.16.0 Dec 17, 2025
0.15.1 Oct 7, 2025
0.15.0 Mar 27, 2025
0.2.0 Jul 24, 2019

#32 in HTTP client

Download history 41486/week @ 2025-10-27 44136/week @ 2025-11-03 26428/week @ 2025-11-10 43768/week @ 2025-11-17 35852/week @ 2025-11-24 45043/week @ 2025-12-01 54353/week @ 2025-12-08 55386/week @ 2025-12-15 23211/week @ 2025-12-22 20051/week @ 2025-12-29 30179/week @ 2026-01-05 49435/week @ 2026-01-12 57666/week @ 2026-01-19 68437/week @ 2026-01-26 70257/week @ 2026-02-02 66982/week @ 2026-02-09

264,787 downloads per month
Used in 63 crates (27 directly)

Apache-2.0

305KB
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

~10–25MB
~250K SLoC