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
| OpCode | Constant | QueueName | Count | Body |
|---|---|---|---|---|
| 0x01 | OP_PUB_SINGLE | Target queue | seq_id | Single raw payload |
| 0x02 | OP_PUB_BATCH | Target queue | batch_id / count | Packed [len: u32 LE][payload]... |
| 0x03 | OP_SUB | Queue to consume | Initial credit (>=1024) | Empty |
| 0x04 | OP_ACK_RANGE | Empty | Additive credit count | Empty |
| 0x05 | OP_AUTH | RBAC username | 0 | UTF-8 password |
| 0x81 | OP_PUB_ACK | Empty | seq_or_batch_id | [acked_count: u32 LE] (4B) |
| 0x82 | OP_DELIVER_BATCH | Empty | msg_count | Packed [len: u32 LE][payload]... |
| 0x85 | OP_AUTH_OK | Empty | 0 | Empty |
| 0x8F | OP_ERROR | Empty | HTTP-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))