Protocol Overview
Slung provides a minimal HTTP/WebSocket API for time-series data ingestion and health monitoring.Base URL
Available Endpoints
| Method | Endpoint | Description |
|---|---|---|
| GET | / | WebSocket upgrade for streaming data |
| POST | / | Returns error (WebSocket required) |
| GET | /health | Health 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(8 bytes): Unix timestamp in nanoseconds as signed 64-bit integervalue(8 bytes): Data point value as 64-bit floatseries_len(2 bytes): Length of series name stringtag_count(2 bytes): Number of tagsseries(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"]
Error Handling
Invalid Messages
If a binary message cannot be decoded, the server logs a warning and continues processing: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