Crates.io | eventsource-threaded |
lib.rs | eventsource-threaded |
version | 0.1.0 |
source | src |
created_at | 2021-01-09 13:00:38.817253 |
updated_at | 2021-01-09 13:00:38.817253 |
description | Library for accessing EventSource/Server-Sent Events endpoints via threads with headers support. |
homepage | |
repository | https://github.com/robkorn/eventsource-threaded |
max_upload_size | |
id | 336404 |
size | 60,792 |
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.
EventSource-Threaded is a fork of this EventSource library created by lluchs. The primary differences are:
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());
}
}