pub async fn handshake(
transport: &(impl ClientTransport + ?Sized),
config: &ClientConfig,
) -> Result<NegotiatedSession, HandshakeError>Expand description
Establishes a session over transport.
?Sized because Client holds an Arc<dyn ClientTransport>, and a
caller who has one of those could not otherwise use the handshake that
produces the session the Client wants. Requiring a concrete transport
here would mean the caller keeps the concrete type alive solely to call
this, then boxes it immediately afterwards โ a step with no purpose beyond
satisfying a bound.
Sends INITIALIZE on every revision that has it and server/discover on
2026-07-28, then โ on the revisions that have one โ the INITIALIZED
notification. The notification is not optional: a server that has not been
told the client is ready will not answer anything else, so a client that
skipped it would look connected and then hang on its first call.
ยงErrors
HandshakeError::Transport if the request or the notification could not be
delivered, HandshakeError::MalformedResult if a required field of the
answer is missing, and NegotiationError through
HandshakeError::Negotiation if the two sides have no revision in common.