pub fn encode_retire(version: u32) -> StringExpand description
What: The line that asks a service to retire, written in the protocol version that service speaks. Why: A service reads a line only in its own version, except that services built with this check read a retire at any version. A service of an earlier release (the ones that sent no release in their greeting) refuses a retire written in a newer version as unsupported and stays, so the line must carry the version the service announced.
In TS you’d write (pseudocode):
JSON.stringify({ type: 'retire', version: announcedVersion })