Skip to main content

Session Commands

Commands for managing client sessions.

HELLO

Initiates a connection and negotiates protocol version and wire mode.

Must be the first command sent on a new connection.

Request

{
"op": "HELLO",
"params": {
"protocol_version": 1,
"client_name": "my-app",
"wire_modes": ["binary_json", "jsonl"],
"features": ["idempotency", "batch", "wal_read"]
}
}
ParameterTypeRequiredDescription
protocol_versionintegerYesRequested protocol version
client_namestringNoClient application name
wire_modesstring[]NoPreferred wire modes (priority-ordered)
featuresstring[]NoRequested features

Response

{
"status": "ok",
"result": {
"protocol_version": 1,
"wire_mode": "binary_json",
"server_name": "rstmdb",
"server_version": "0.1.1",
"features": ["idempotency", "batch", "wal_read"]
}
}
FieldDescription
protocol_versionNegotiated version
wire_modeSelected wire mode from client's priority list
server_nameServer name
server_versionServer version string
featuresIntersection of requested and available features

Errors

CodeDescription
UNSUPPORTED_PROTOCOLProtocol version not supported

AUTH

Authenticates the session with a bearer token.

Request

{
"op": "AUTH",
"params": {
"method": "bearer",
"token": "your-secret-token"
}
}
ParameterTypeRequiredDescription
methodstringYesAuthentication method (only "bearer" supported)
tokenstringYesBearer token

Response

{
"status": "ok",
"result": {
"authenticated": true
}
}

Errors

CodeDescription
AUTH_FAILEDInvalid token

Token Hashing

Tokens are validated against SHA-256 hashes stored in the server config:

# Generate hash for a token
rstmdb-cli hash-token my-secret-token
# Output: 9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08

Multiple tokens can be configured simultaneously. Tokens can also be loaded from a secrets file via the secrets_file config option.


PING

Health check command.

Request

{
"op": "PING"
}

Response

{
"status": "ok",
"result": {
"pong": true
}
}

Use for:

  • Connection health checks
  • Keep-alive in long-running connections
  • Load balancer health probes

INFO

Returns server information and capabilities.

Request

{
"op": "INFO"
}

Response

{
"status": "ok",
"result": {
"server_name": "rstmdb",
"server_version": "0.1.1",
"protocol_version": 1,
"features": ["idempotency", "batch", "wal_read"],
"max_frame_bytes": 16777216,
"max_batch_ops": 100
}
}
FieldDescription
server_nameServer name
server_versionServer version
protocol_versionProtocol version
featuresAvailable features
max_frame_bytesMaximum frame payload size
max_batch_opsMaximum operations per batch

BYE

Gracefully closes the connection.

Request

{
"op": "BYE"
}

Response

{
"status": "ok",
"result": {
"goodbye": true
}
}

After sending BYE:

  1. Server sends response
  2. Server closes the connection
  3. Any pending subscriptions are cancelled

Note: You can also close the TCP connection directly, but BYE ensures clean subscription cleanup.