Connect to a server whose protocol era is unknown, per the transport
backward-compatibility rules. Probes server/discover first:
- success → modern server; switch to the newest mutually-supported
version (stateless draft mode if that version uses per-request
_meta, otherwise an initialize handshake for that stable version);
- Method not found (-32601) → legacy server; fall back to the
initialize handshake;
- UnsupportedProtocolVersionError (-32004) → modern server; pick from
the advertised supported list rather than falling back.
Returns the negotiated protocol version. Throws if there is no mutually
supported version, or on any other error.
Connect to a server whose protocol era is unknown, per the transport backward-compatibility rules. Probes server/discover first: - success → modern server; switch to the newest mutually-supported version (stateless draft mode if that version uses per-request _meta, otherwise an initialize handshake for that stable version); - Method not found (-32601) → legacy server; fall back to the initialize handshake; - UnsupportedProtocolVersionError (-32004) → modern server; pick from the advertised supported list rather than falling back. Returns the negotiated protocol version. Throws if there is no mutually supported version, or on any other error.