๐ฆ Wyoming Event Format
Wyoming is a streaming peer-to-peer protocol using newline-delimited JSON (JSONL) plus optional binary data.
It is designed to be:
- ๐งฉ Simple to implement
- ๐ Streaming-friendly (audio chunking)
- ๐ Language-agnostic and open
๐ Message Structure
Each Wyoming message is made of:
{ "type": "...", "data_length": ..., "payload_length": ... }\n
<data_length bytes> (optional, UTF-8 JSON)
<payload_length bytes> (optional, binary payload)
- Header (required): JSON object, UTF-8, newline terminated
- Data section (optional): UTF-8 JSON
- Payload (optional): binary blob (e.g., PCM audio)
๐งช Minimal Example (Audio Chunk)
{ "type": "audio-chunk", "data_length": 0, "payload_length": 3200 }
Followed by 3200 bytes of raw PCM audio.
๐ With Additional Metadata
{ "type": "transcribe", "data_length": 45, "payload_length": 0 }
Followed by:
{ "name": "whisper", "language": "en" }
No binary payload in this case.
๐งฐ Python Example: Creating an Event
from wyoming.event import Event
event = Event(
type="synthesize",
data={"text": "Hello world"},
payload=b""
)
raw_bytes = event.to_bytes()
๐งฐ Python Example: Reading an Event from a Stream
from wyoming.event import read_event
async def handle(reader):
event = await read_event(reader)
print(event.type, event.data)
๐งช CLI Test (Netcat)
To verify a Wyoming-compatible server is running:
echo '{"type":"describe"}' | nc localhost 10200
Expect response like:
{ "type": "info", ... }
๐ Format Summary
| Component | Description |
|---|---|
type |
Event type string (e.g. transcribe) |
data_length |
Length of optional JSON block in bytes |
payload_length |
Length of optional binary in bytes |
Wyoming works over:
- TCP (tcp://host:port)
- Unix sockets (unix:///path)
- Standard I/O (stdio://)