Home / Docs / AetherWire v1 Binary Protocol Spec

AetherWire v1 Binary Protocol Spec

AetherWire v1 is AetherMQ’s ultra-lean native binary protocol engineered for 15M+ msg/s throughput with <50 ns per-message frame parsing over TCP, TLS 1.3, or Unix Domain Sockets.

16-Byte Fixed Little-Endian Frame Header

Every frame starts with the 4-byte ASCII magic "AETH" (automatically sniffed on :5672, --tls-bind, and --uds). Maximum BodyLen is 64 MiB. Batch frames tightly pack items as [len: u32 LE][payload].

Wire Layout (Little-Endian)
[Magic "AETH" (4B)] [Op (1B)] [Flags (1B)] [QueueLen (u16 LE)] [Count/Seq (u32 LE)] [BodyLen (u32 LE)]
[QueueName (QueueLen B, UTF-8)] [Body (BodyLen B)]

Packed Batch Body (OP_PUB_BATCH 0x02 / OP_DELIVER_BATCH 0x82):
[len_1: u32 LE][payload_1] [len_2: u32 LE][payload_2] ...

All 9 OpCodes

OpCodeConstantQueueNameCountBody
0x01OP_PUB_SINGLETarget queueseq_idSingle raw payload
0x02OP_PUB_BATCHTarget queuebatch_id / countPacked [len: u32 LE][payload]...
0x03OP_SUBQueue to consumeInitial credit (>=1024)Empty
0x04OP_ACK_RANGEEmptyAdditive credit countEmpty
0x05OP_AUTHRBAC username0UTF-8 password
0x81OP_PUB_ACKEmptyseq_or_batch_id[acked_count: u32 LE] (4B)
0x82OP_DELIVER_BATCHEmptymsg_countPacked [len: u32 LE][payload]...
0x85OP_AUTH_OKEmpty0Empty
0x8FOP_ERROREmptyHTTP-like code (401/403/422/507)UTF-8 error message

Zero-Dependency Python 3 Client Example

Python 3 · PubBatch + Sub + DeliverBatch + AckRange
import socket, struct

def pack(op, q, count, body=b""):
    qb = q.encode()
    return struct.pack("<4sBBHII", b"AETH", op, 0, len(qb), count, len(body)) + qb + body

def recv_n(s, n):
    b = bytearray()
    while len(b) < n:
        c = s.recv(n - len(b))
        if not c: raise EOFError()
        b.extend(c)
    return bytes(b)

def read_frame(s):
    m, op, _, ql, cnt, bl = struct.unpack("<4sBBHII", recv_n(s, 16))
    assert m == b"AETH"
    return op, recv_n(s, ql).decode(), cnt, recv_n(s, bl)

with socket.create_connection(("127.0.0.1", 5672)) as s:
    msgs = [b"tick-1", b"tick-2"]
    body = b"".join(struct.pack("<I", len(x)) + x for x in msgs)
    s.sendall(pack(0x02, "DEMO.WIRE", len(msgs), body))
    print("PUB_ACK:", read_frame(s))
    s.sendall(pack(0x03, "DEMO.WIRE", 1024))
    op, _, cnt, d = read_frame(s)
    print("DELIVER:", op, cnt, len(d))
    s.sendall(pack(0x04, "", cnt))