File tree Expand file tree Collapse file tree 6 files changed +72
-46
lines changed Expand file tree Collapse file tree 6 files changed +72
-46
lines changed Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+ set -ue
4
+
5
+ cd eventsource-client
6
+ cargo package
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+ set -ue
4
+
5
+ echo " DRY RUN: not publishing to crates.io, only copying crate"
6
+ cp ./target/package/* .crate " ${LD_RELEASE_ARTIFACTS_DIR} "
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+ set -ue
4
+
5
+ export CARGO_REGISTRY_TOKEN=" $( cat " ${LD_RELEASE_SECRETS_DIR} /rust_cratesio_api_token" ) "
6
+
7
+ cd eventsource-client
8
+ cargo publish
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+ set -ue
4
+
5
+ sed -i " /^version\b/c version = \" ${LD_RELEASE_VERSION} \" " ./eventsource-client/Cargo.toml
Load Diff This file was deleted.
Original file line number Diff line number Diff line change
1
+ eventsource-client/README.md
Original file line number Diff line number Diff line change
1
+ # eventsource-client
2
+
3
+ Client for the [ Server-Sent Events] protocol (aka [ EventSource] ).
4
+
5
+ [ Server-Sent Events ] : https://html.spec.whatwg.org/multipage/server-sent-events.html
6
+ [ EventSource ] : https://developer.mozilla.org/en-US/docs/Web/API/EventSource
7
+
8
+ ## Requirements
9
+
10
+ Requires tokio.
11
+
12
+ ## Usage
13
+
14
+ Example that just prints the type of each event received:
15
+
16
+ ``` rust
17
+ use eventsource_client :: Client ;
18
+
19
+ let mut client = Client :: for_url (" https://example.com/stream" )?
20
+ . header (" Authorization" , " Basic username:password" )?
21
+ . build ();
22
+
23
+ client . stream ()
24
+ . for_each (| event | {
25
+ Ok (println! (" got an event: {}" , event . event_type))
26
+ })
27
+ . map_err (| e | println! (" error streaming events: {:?}" , e ));
28
+ ```
29
+
30
+ (Some boilerplate omitted for clarity; see [ examples directory] for complete,
31
+ working code.)
32
+
33
+ [ examples directory ] : ../../tree/master/examples
34
+
35
+ ## Features
36
+
37
+ * tokio-based streaming client.
38
+ * Supports setting custom headers on the HTTP request (e.g. for endpoints
39
+ requiring authorization).
40
+ * Retry for failed connections.
41
+ * Reconnection if connection is interrupted, with exponential backoff.
42
+
43
+ ## Stability
44
+
45
+ Early stage release for feedback purposes. May contain bugs or performance
46
+ issues. API subject to change.
You can’t perform that action at this time.
0 commit comments