Skip to main content

connect

Function connect 

Source
pub async fn connect(
    address: &str,
    versions: Option<&[OcppVersion]>,
    options: Option<ConnectOptions<'_>>,
) -> Result<NegotiatedClient, Box<dyn Error + Send + Sync>>
Expand description

Connect to an OCPP server over WebSocket, offering the given versions (or, if None, every version compiled into this crate via its ocpp_1_6/ocpp_2_0_1/ocpp_2_1 features) in the Sec-WebSocket-Protocol header, and using whichever one the server picks - rather than requiring the caller to already know the server’s supported version like connect_1_6/connect_2_0_1/connect_2_1 do. versions also controls preference order (offered in the slice’s order); the choice among the offered set is entirely the server’s per RFC 6455.