lirays 0.1.2

Rust client for LiRAYS SCADA over WebSocket + Protobuf
Documentation

lirays

Rust client for the LiRAYS SCADA WebSocket + Protobuf API.

Features

  • Connect with or without authentication (Authorization: Bearer <PAT>)
  • Namespace operations: list, create, delete, metadata edit
  • Typed value operations: set/get for integer, float, text, and boolean
  • Bulk namespace creation from JSON schema
  • Realtime subscriptions for variable values

Installation

cargo add lirays

Quick Start

use lirays::{Client, ConnectionOptions};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let options = ConnectionOptions::new(
        "127.0.0.1",
        8245,
        false, // tls
        Some("pat_xxx.yyy".to_string()),
    );
    let client = Client::connect_with_options(options).await?;

    let (_folders, vars) = client.list(Some("/".into()), 5_000).await?;
    println!("vars: {}", vars.len());

    client.disconnect().await?;
    Ok(())
}

Connection Modes

  • Client::connect(host, port, tls)
  • Client::connect_with_pat(host, port, tls, pat_token)
  • Client::connect_with_options(ConnectionOptions)
  • ConnectionOptions::with_insecure_tls(true) for local self-signed certs only

Examples

A full scenario runner is provided in examples/demo.

Run all scenarios:

cargo run --example demo -- \
  --demo all \
  --host 127.0.0.1 \
  --port 8245 \
  --tls false \
  --allow-insecure-tls false \
  --auth true \
  --pat-token "pat_xxx.yyy"

Run one scenario:

cargo run --example demo -- --demo basic --auth false

See examples/demo/README.md for all options.

For local development with self-signed certs, you can opt in to insecure TLS validation:

cargo run --example demo -- --demo basic --tls true --allow-insecure-tls true --auth false

Release

This repository includes a GitHub Actions release workflow that publishes to crates.io using Trusted Publishing (OIDC) when you push a tag like v0.1.2.

License

MIT (LICENSE).