Expand description
Slim WebSocket subscriber for the relay’s /ws endpoint.
Phase 5 ships this for cinch pull --watch. It is intentionally
narrower than desktop/src-tauri/src/ws.rs (which still owns its
tauri-coupled lifecycle, tray status, db inserts, image fetch, and
key-exchange responder). Once that desktop logic gets refactored to
consume callbacks from this module, the duplicated reconnect/decrypt
plumbing inside desktop’s ws.rs can shrink to a thin event bridge.
The client connects with bearer-token auth via the URL query string
(?token=...), reads frames, decodes WSMessage, decrypts clip
content when encrypted=true, and forwards every interesting message
through an mpsc::Sender<WsEvent> provided by the caller.
Structs§
Enums§
- Decrypt
Fail Reason - Decrypt
Outcome - Outcome of a single decrypt attempt on an incoming clip.
- WsError
- WsEvent
- WsStatus
Functions§
- decrypt_
clip_ content - Decrypt
clip.contentin place ifclip.encryptedand a key is available. Returns a typed outcome — never silently returns ciphertext as plaintext. - run
- Connect to the relay and forward decoded events to
txuntil the caller drops the receiver. Reconnects on socket error with exponential backoff (1s, 2s, 4s … capped at 30s). Returns whentxis closed.