1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
//! Async Server Sent Event parser and encoder.
//!
//! # Example
//!
//! ```norun
//! use tide::Request;
//!
//! #[async_std::main]
//! async fn main() -> http_types::Result<()> {
//! let mut app = tide::new();
//!
//! app.at("/sse").get(|req| async move {
//! let mut res = tide_compressed_sse::upgrade(req, |_req: Request<()>, sender| async move {
//! sender.send("message", "foo", None).await?;
//!
//! Ok(())
//! });
//!
//! Ok(res)
//! });
//!
//! app.listen("localhost:8080").await?;
//!
//! Ok(())
//! }
//! ```
//!
//! # References
//!
//! - [SSE Spec](https://html.spec.whatwg.org/multipage/server-sent-events.html#concept-event-stream-last-event-id)
//! - [EventSource web platform tests](https://github.com/web-platform-tests/wpt/tree/master/eventsource)
use encode;
use Event;
use Message;
pub use crateupgrade;
pub use crateSender;
/// Exports for tests
pub use Lines;