Skip to content

robkorn/eventsource-threaded

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

EventSource-Threaded

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:

  • The EventSource client is now threaded
  • Adding arbitrary header values is now supported (important for use cases where you need to set cookies for Authorization for example)
  • Minor renaming/removing methods/interface change

Examples

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());
    }

}

About

Threaded Rust client for the EventSource browser API with support for headers.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages