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
59
/// Default SSE `Content-Type` header value with UTF-8 charset.
pub const SSE_CONTENT_TYPE: &str = "text/event-stream; charset=utf-8";
/// Default `Cache-Control` directive for SSE streams.
pub const SSE_CACHE_CONTROL: &str = "no-cache";
/// Reverse-proxy buffering disable header name for SSE streams.
pub const SSE_ACCEL_BUFFERING_HEADER: &str = "x-accel-buffering";
/// Reverse-proxy buffering disable header value for SSE streams.
pub const SSE_ACCEL_BUFFERING_VALUE: &str = "no";
/// Default heartbeat interval in milliseconds.
pub const DEFAULT_SSE_HEARTBEAT_MS: u64 = 15_000;
/// Default client reconnect retry hint in milliseconds.
pub const DEFAULT_SSE_RETRY_MS: u64 = 3_000;
/// Default bounded replay history retained per topic for `Last-Event-ID` resume.
pub const DEFAULT_SSE_REPLAY_CAPACITY: usize = 64;
/// Default broadcast channel capacity per topic.
pub const DEFAULT_SSE_CHANNEL_CAPACITY: usize = 256;
/// Default maximum number of active topics allowed in one [`SseHub`].
pub const DEFAULT_SSE_MAX_TOPICS: usize = 1024;
/// Number of lock-striped topic shards inside [`crate::SseHub`].
pub const SSE_SHARD_COUNT: usize = 64;
/// SSE `id` field prefix.
pub const SSE_FIELD_ID: &str = "id: ";
/// SSE `event` field prefix.
pub const SSE_FIELD_EVENT: &str = "event: ";
/// SSE `retry` field prefix.
pub const SSE_FIELD_RETRY: &str = "retry: ";
/// SSE `data` field prefix.
pub const SSE_FIELD_DATA: &str = "data: ";
/// SSE comment line prefix.
pub const SSE_COMMENT_PREFIX: &str = ": ";
/// Default heartbeat comment payload.
pub const SSE_HEARTBEAT_COMMENT: &str = "keep-alive";
/// Pre-encoded static SSE keep-alive heartbeat wire frame.
pub const SSE_HEARTBEAT_FRAME: & = b": keep-alive\n\n";
/// Maximum decimal digit length of an unsigned 64-bit integer.
pub const U64_DECIMAL_BUF_LEN: usize = 20;
/// Error display text when an [`SseHub`] reaches its topic limit.
pub const ERR_TOPIC_LIMIT: &str = "SSE topic limit reached";
/// Error display text when a topic broadcast channel has closed.
pub const ERR_CHANNEL_CLOSED: &str = "SSE topic channel closed";