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
//! Remote UI protocol layer for server-driven rendering.
//!
//! This module provides a framework-agnostic [`RemoteSession`] that manages
//! a per-client engine, component discovery, state, and the WebSocket message
//! protocol. Plug it into any async server (Axum, Actix, Warp, etc.).
//!
//! # Protocol Flow
//!
//! ```text
//! Client Server
//! │── connect ──────────────────>│
//! │── hello {sessionId?} ──────>│
//! │<── sessionAck ──────────────│
//! │<── initialTree {patches} ───│
//! │ │
//! │── dispatchAction ──────────>│ (user taps button)
//! │<── patch {patches} ─────────│ (engine re-renders)
//! │<── stateUpdate {state} ─────│ (optional, for tooling)
//! │ │
//! │── close ────────────────────>│
//! ```
//!
//! # Example (Axum)
//!
//! ```rust,ignore
//! use hypen_server::prelude::*;
//! use hypen_server::remote::{RemoteSession, SessionConfig};
//!
//! // In your WebSocket handler:
//! async fn ws_handler(ws: WebSocket, session: RemoteSession) {
//! let (mut sender, mut receiver) = ws.split();
//!
//! // Send initial messages
//! let hello_response = session.handle_hello(None);
//! for msg in hello_response {
//! sender.send(Message::Text(msg)).await.unwrap();
//! }
//!
//! // Message loop
//! while let Some(Ok(msg)) = receiver.next().await {
//! let responses = session.handle_message(msg.to_text().unwrap());
//! for resp in responses {
//! sender.send(Message::Text(resp)).await.unwrap();
//! }
//! }
//! }
//! ```
pub use ;
pub use ;
pub use *;