Crates.io | eventsource-client |
lib.rs | eventsource-client |
version | 0.13.0 |
source | src |
created_at | 2019-07-18 19:09:19.592798 |
updated_at | 2024-07-30 18:56:00.546018 |
description | Client for the Server-Sent Events protocol (aka EventSource) |
homepage | |
repository | https://github.com/launchdarkly/rust-eventsource-client |
max_upload_size | |
id | 149926 |
size | 2,897,947 |
Client for the Server-Sent Events protocol (aka EventSource).
Requires tokio.
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.)
Early stage release for feedback purposes. May contain bugs or performance issues. API subject to change.