Skip to main content

Protocol Overview

Slung provides a minimal HTTP/WebSocket API for time-series data ingestion and health monitoring.

Base URL

http://0.0.0.0:2077

Available Endpoints

MethodEndpointDescription
GET/WebSocket upgrade for streaming data
POST/Returns error (WebSocket required)
GET/healthHealth check endpoint

Authentication

Currently, Slung does not implement authentication. All endpoints are open.

Data Format

Slung uses binary WebSocket frames for data ingestion. Text frames are also accepted but must contain binary-encoded data.

Binary Message Format

All numeric values use little-endian byte order:
[timestamp:i64][value:f64][series_len:u16][tag_count:u16][series][tag_len:u16+tag_bytes]...
Field breakdown:
  • timestamp (8 bytes): Unix timestamp in nanoseconds as signed 64-bit integer
  • value (8 bytes): Data point value as 64-bit float
  • series_len (2 bytes): Length of series name string
  • tag_count (2 bytes): Number of tags
  • series (variable): Series name UTF-8 string
  • Tags (variable): Each tag is [u16 length][bytes]

Example Message Structure

For a message with:
  • Timestamp: 1709481600000000000
  • Value: 42.5
  • Series: "cpu"
  • Tags: ["host=server1", "region=us-east"]
The binary layout would be:
[8 bytes timestamp][8 bytes value][0x03 0x00][0x02 0x00]["cpu"][0x0c 0x00]["host=server1"][0x0e 0x00]["region=us-east"]

Error Handling

Invalid Messages

If a binary message cannot be decoded, the server logs a warning and continues processing:
Ignoring websocket payload; expected binary [i64 timestamp][f64 value][u16 series_len][u16 tag_count][series][tags...]

Connection Errors

WebSocket connections are tracked with unique IDs. If the internal channel closes or is canceled, the connection terminates gracefully.

Next Steps

Health Endpoint

Check server health status

WebSocket API

Stream time-series data

Build docs developers (and LLMs) love