async fn run_session(
app_token: &str,
channel_id: &str,
target_agent: &Option<String>,
http: &Client,
health: &Arc<Mutex<BridgeHealth>>,
primary: &mut WsHalf,
) -> Result<(), String>Expand description
Runs one connection’s session loop, holding at most two live socket
halves (primary + optionally old, see module doc comment).
Returns Ok(()) on a clean close (primary closed with no error) or
Err(e) on anything reconnect-worthy (unexpected close, dead-connection
timeout, ws send/recv error). Either way the caller (run_socket_loop)
starts a fresh session with a freshly-fetched URL.