lirays 0.1.0

Rust client for LiRAYS-SCADA over WebSocket + Protobuf
Documentation

lirays-ws-client

Rust client for LiRAYS-SCADA WebSocket + protobuf protocol.

Authentication model

This client supports authentication using a PAT token generated by lirays (generate-admin-token / generate-operator-token).

The PAT is sent as:

  • Authorization: Bearer <pat_token> during WebSocket upgrade.

Quick start

use lirays_ws_client::Client;

#[tokio::main]
async fn main() -> anyhow::Result<()> {
    let client = Client::connect_with_pat(
        "127.0.0.1",
        8245,
        false, // tls
        "pat_xxx.yyy",
    )
    .await?;

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

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

If server auth is disabled, use Client::connect(host, port, tls).

Main capabilities

  • Namespace CRUD: create folders, create variables, list, delete.
  • Typed value writes/reads: integer, float, text, boolean.
  • Metadata updates via edit_variable_metadata.
  • Bulk namespace creation from JSON schema (create_bulk_from_json).
  • Realtime subscriptions (subscribe_var_values).

Development

cargo check --manifest-path clients/rust-client/Cargo.toml

Run demos:

cargo run --manifest-path clients/rust-client/Cargo.toml --bin demo -- --demo all --auth true --pat-token "pat_xxx.yyy"