Skip to content

TCP Protocol

High-performance binary protocol on port 6789.

Connection

const socket = await Bun.connect({
hostname: 'localhost',
port: 6789,
socket: {
data(socket, data) {
// Handle response
},
},
});

Commands

Core Operations

CommandDescription
PUSHAdd job to queue
PUSHBBatch push jobs
PULLGet next job
PULLBBatch pull jobs
ACKMark completed
ACKBBatch acknowledge
FAILMark failed

Query Operations

CommandDescription
GetJobGet job by ID
GetStateGet job state
GetResultGet job result
GetJobsList jobs
GetJobCountsCount by state

Queue Control

CommandDescription
PausePause queue
ResumeResume queue
DrainRemove waiting jobs
ObliterateRemove all data

DLQ

CommandDescription
DlqGet DLQ jobs
RetryDlqRetry DLQ jobs
PurgeDlqClear DLQ

Message Format

[4 bytes: message length]
[JSON payload]

Authentication

{ "cmd": "AUTH", "token": "your-token" }