Skip to main content

connect

Function connect 

Source
pub(super) fn connect(
    core: &mut ProtocolCore,
    url: String,
    jwt: String,
    room: Option<String>,
) -> Vec<Command>
Expand description

starts a fresh connection attempt from an inactive or recovering state

this is the only lifecycle entry point that wipes both runtime state and sticky replay state before reconnecting a brand-new connect means “start over with this endpoint and auth context”, not “resume whatever the previous user was trying to do”

calls from live admission states are ignored so the host cannot accidentally stack overlapping connection attempts on top of an already-live user a call from ConnectionState::Recovering also cancels the stale recovery timer before the new socket attempt starts

Disconnected --connect(url, jwt, room)--> Connecting
Closed       --connect(url, jwt, room)--> Connecting
Recovering  --connect(url, jwt, room)--> Connecting