Exact-version handshake rules shared by every SDK.
Wire shape:
HELLO = [tag=1, protocol_version, runtime, max_concurrency, max_streams, features]
READY = [tag=2, protocol_version, limits]The worker sends HELLO first; the BEAM replies with READY only when
protocol_version matches Portals.Protocol.version/0 exactly. Any
mismatch is a deterministic, unrecoverable startup failure: the
connection is closed and the worker is not marked ready.
Summary
Functions
Validate a decoded HELLO envelope against the BEAM's own protocol version.
Functions
@spec build_hello(binary(), pos_integer(), pos_integer(), [binary()]) :: list()
@spec build_ready(Portals.Protocol.limits()) :: list()
@spec negotiate([term()]) :: {:ok, Portals.Handshake.Hello.t()} | {:error, {:protocol_version_mismatch, pos_integer(), term()}} | {:error, term()}
Validate a decoded HELLO envelope against the BEAM's own protocol version.
Returns {:ok, %Hello{}} only on an exact version match. Any mismatch
returns {:error, {:protocol_version_mismatch, expected, actual}} and
callers must close the connection without sending READY.