Documentation Index
Fetch the complete documentation index at: https://bytebeam.io/docs/llms.txt
Use this file to discover all available pages before exploring further.
You can use ByteBeam Client to push data to Streams. Follow Creating a Stream guide to create streams.
pub fn publish_to_stream(
&self, // Bytebeam Client
stream_name: &str,
sequence: u32,
payload: impl Serialize,
) -> anyhow::Result<u32>
Payload you want to publish must be something that can be Serialized to JSON.
Lets say you have “led_status” stream with field “status”. You can create a struct and use serde::Serialize attribute.
#[derive(Serialize)]
struct LedStream {
// your custom fields!
status: String,
}
fn main() {
// ....
let bytebeam_client = ByteBeamClient::init()?;
let sequence = 1;
let message = LedStream {
status: "ON".into(),
};
// You can remove .expect and handle the error
bytebeam_client
.publish_to_stream("led_status", sequence, message)
.expect("published successfully");
//...
}
NOTE: Every stream has id and timestamp fields as well, we add them internally, so it is recommended to not include them in your custom struct!
**