[−][src]Crate surf_sse
An implementation of the EventSource API using Surf.
Logging
surf-sse
uses the log
crate for some rudimentary connection logging. If you need to debug
an EventSource connection, enable trace logging for the surf-sse
target. For example, with
env_logger
:
RUST_LOG=surf-sse=trace \
cargo run
Examples
use futures_util::stream::TryStreamExt; // for try_next() use surf_sse::EventSource; let mut events = EventSource::new(Url::parse("https://hub.u-wave.net/events").unwrap()); while let Some(message) = events.try_next().await.unwrap() { dbg!(message); }
Structs
Event | An event. |
EventSource | A Server-Sent Events/Event Sourcing client, similar to |
Url | A parsed URL record. |
Enums
Error | Represents an EventSource "error" event. |
ReadyState | The state of the connection. |