[][src]Crate eventsource_client

Client for the Server-Sent Events protocol (aka EventSource).

use eventsource_client::Client;

let mut client = Client::for_url("https://example.com/stream")?
    .header("Authorization", "Basic username:password")?
    .build();

client.stream()
    .for_each(|event| {
        Ok(println!("got an event: {}", event.event_type))
    })
    .map_err(|e| println!("error streaming events: {:?}", e));

Structs

Client

Client that connects to a server using the Server-Sent Events protocol and consumes the event stream indefinitely.

ClientBuilder
Event

Enums

Error

Error type returned from this library's functions.

Type Definitions

EventStream
Result