Installation
Add the SDK to yourCargo.toml:
Quick Start
Create a reactive workflow that monitors a live stream:Key Concepts
Host Functions
Workflows execute in a WebAssembly sandbox and communicate with Slung through host functions. These functions enable:- Querying live and historical data
- Writing events
- Sending writeback messages to WebSocket clients
- Making HTTP requests
Event Model
Events received from live queries contain:Query Syntax
Live and historical queries use the format:AVG- Running averageSUM- Cumulative sumMIN- Minimum valueMAX- Maximum value
Querying Data
Live Queries
Register a live query to receive streaming updates:Historical Queries
Query aggregated historical data:Polling Aggregate State
Poll once for the current aggregate state:Writing Data
Writing Events
Write new events to Slung from your workflow:series=<name> specifies the series name. All other tags are treated as regular tags.
Writeback to WebSocket Clients
Send messages back to WebSocket producers:HTTP Writeback
Make HTTP requests to external services:Prelude
Theslung::prelude module exports commonly used items:
Eventstruct- All query and write functions
- The
#[main]macro Resulttype fromstd::io
Next Steps
Workflow API Reference
Complete API reference for workflow functions
Host Functions
Detailed host function reference