Basic implementation of websocket

This commit is contained in:
2025-11-20 16:06:00 +01:00
parent 0d8905d842
commit a1b22699e9
7 changed files with 240 additions and 2 deletions

View File

@@ -1,3 +1,5 @@
use std::time::Duration;
/// Auth header
pub const API_AUTH_HEADER: &str = "x-client-auth";
@@ -16,3 +18,11 @@ pub mod sessions {
/// Authenticated ID
pub const USER_ID: &str = "uid";
}
/// How often heartbeat pings are sent.
///
/// Should be half (or less) of the acceptable client timeout.
pub const WS_HEARTBEAT_INTERVAL: Duration = Duration::from_secs(5);
/// How long before lack of client response causes a timeout.
pub const WS_CLIENT_TIMEOUT: Duration = Duration::from_secs(10);