Crates.io | sse-client |
lib.rs | sse-client |
version | 1.1.1 |
source | src |
created_at | 2018-08-25 23:59:03.56061 |
updated_at | 2020-03-26 06:50:35.408255 |
description | Client for streams of Server-Sent Events |
homepage | |
repository | https://github.com/viniciusgerevini/sse-client |
max_upload_size | |
id | 81447 |
size | 73,520 |
EventSource implementation in Rust to handle streams of Server-Sent Events. It handles connections, redirections, retries and message parsing.
To know more about SSE: Standard | EventSource interface
Usage:
extern crate sse_client;
use sse_client::EventSource;
let event_source = EventSource::new("http://event-stream-address/sub").unwrap();
event_source.on_message(|message| {
println!("New message event {:?}", message);
});
event_source.add_event_listener("error", |error| {
println!("Error {:?}", error);
});
Or:
extern crate sse_client;
use sse_client::EventSource;
let event_source = EventSource::new("http://event-stream-address/sub").unwrap();
for event in event_source.receiver().iter() {
println!("New Message: {}", event.data);
}
native-tls
enables support for HTTPS URLs using native-tlsnative-tls-vendored
will additionally link OpenSSL staticallyLicensed under either of
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.