Headers And Binary
Headers are sent with HPUB. Header messages received from the server are parsed from
HMSG.
headers = {"traceparent" => "00-4bf92f3577b34da6a3ce929d0e0e4736-00f067aa0ba902b7-00"}payload = "\x00frame\xFF".b
client.subscribe("tcp.frames") do |message| puts message.headers["traceparent"] puts message.data.bytesizeend
client.publish("tcp.frames", payload, headers: headers)Header reads
Section titled “Header reads”Header keys preserve their received casing, and reads are case-insensitive:
message.headers["traceparent"]message.headers["TraceParent"]Repeated headers are stored as arrays.
Binary payloads
Section titled “Binary payloads”Payload size is computed with bytesize, and the payload is written separately from the
protocol line. This keeps NUL bytes and non-UTF-8 bytes intact.
payload = "\x00\x01\xFF".bclient.publish("frames.raw", payload)Headers and binary payloads can be used together.