Skip to content

Function envelope::negotiate

zaun_community_protocol::envelope::negotiate · Function

pub fn negotiate(client: VersionRange, host: VersionRange) -> Result<u16, ErrorBody>

Chooses the highest version in both ranges (session.hello, the protocol).

UNSUPPORTED_VERSION carrying host when the ranges do not overlap (or client is empty, min > max). Send it as a version-1 envelope (ResponseEnvelope::error does); the connection stays unnegotiated.

Full rustdoc page