Skip to main content

Overview

The III struct is the main entry point for the SDK. It manages WebSocket connections to the III Engine, handles function registration, and provides methods for invoking remote functions.

Creating a Client

III::new

Create a new III client with default worker metadata.
&str
required
WebSocket address of the III Engine (e.g., ws://localhost:49134)
III
A new III client instance
Example:

III::with_metadata

Create a new III client with custom worker metadata.
&str
required
WebSocket address of the III Engine
WorkerMetadata
required
Custom metadata describing this worker (runtime, version, name, OS)
Example:

Connection Management

connect

Connect to the III Engine and start the message loop.
Result<(), IIIError>
Returns Ok(()) on successful connection, or an error if connection fails
Example:
The connect method spawns a background task that maintains the WebSocket connection. If the connection is lost, it will automatically reconnect with exponential backoff.

shutdown_async

Shutdown the client and flush all pending telemetry data.
Example:
When the otel feature is enabled, this method waits for all spans, metrics, and logs to be exported before returning. Use this instead of the deprecated shutdown() method to ensure telemetry is not lost.

Configuration

address

Get the WebSocket address this client connects to.
Example:

set_metadata

Set custom worker metadata (must be called before connect).
WorkerMetadata
required
Worker metadata to register with the engine

set_otel_config

Set OpenTelemetry configuration (requires otel feature, must be called before connect).
OtelConfig
required
OpenTelemetry configuration including service name, metrics settings, etc.
Example:

Types

WorkerMetadata

Metadata about a worker that is registered with the engine.
Default Implementation: The default implementation auto-detects:
  • Runtime: "rust"
  • Version: SDK version from Cargo.toml
  • Name: "{hostname}:{pid}"
  • OS: System architecture and family
  • Telemetry: Language locale from environment

IIIError

Error types returned by SDK operations.

See Also