Installation
Initialization
Create and return a connected SDK instance. The WebSocket connection is established automatically in a dedicated background thread with its own tokio runtime. Call [III::shutdown] before the end of main to cleanly stop the
connection and join the background thread. In Rust the process exits
when main returns, terminating all threads — so shutdown() must be
called while main is still running.
Methods
set_headers
Set custom HTTP headers for the WebSocket handshake (call before connect). SignatureParameters
shutdown
Shutdown the III client and wait for the connection thread to finish. This stops the connection loop, sends a shutdown signal, and joins the background connection thread. When theotel feature is enabled,
telemetry is flushed inside the connection thread before it exits.
Signature
shutdown_async
Shutdown the III client. This stops the connection loop and sends a shutdown signal, but it does not joinconnection_thread.
Unlike shutdown, this method does not block
to wait for run_connection() to finish, making it safe to call from
an async context without stalling the executor. When the otel
feature is enabled, telemetry::shutdown_otel() still runs inside the
connection thread after run_connection() returns, so it may not
complete unless shutdown is used to join the thread.
Signature
register_function
Register a function with the engine. Pass a closure/async fn for local execution, or an [HttpInvocationConfig]
for HTTP-invoked functions (Lambda, Cloudflare Workers, etc.).
Signature
Parameters
Example
register_function_with
Register a function with a message and handler directly. SignatureParameters
register_service
Register a service with the engine. SignatureParameters
register_trigger_type
Register a custom trigger type with the engine. Returns a [TriggerTypeRef] handle that can register triggers and
functions with compile-time validated types.
Signature
Parameters
Example
unregister_trigger_type
Unregister a previously registered trigger type. SignatureParameters
register_trigger
Bind a trigger configuration to a registered function. SignatureParameters
Example
trigger
Invoke a remote function. The routing behavior depends on theaction field of the request:
- No action: synchronous — waits for the function to return.
- [
TriggerAction::Enqueue] - async via named queue. - [
TriggerAction::Void] — fire-and-forget.
Parameters
Example
get_connection_state
Get the current connection state. Signaturecreate_channel
Create a streaming channel pair for worker-to-worker data transfer. Returns aChannel with writer, reader, and their serializable refs
that can be passed as fields in invocation data to other functions.
Signature
Parameters
Logger
Structured logger that emits logs as OpenTelemetry LogRecords. Every log call automatically captures the active trace and span context, correlating your logs with distributed traces without any manual wiring. When OTel is not initialized, Logger gracefully falls back to thetracing
crate.
Pass structured data as the second argument to any log method. Using a
serde_json::Value object of key-value pairs (instead of string
interpolation) lets you filter, aggregate, and build dashboards in your
observability backend.
info
Log an info-level message. SignatureParameters
Example
warn
Log a warning-level message. SignatureParameters
Example
error
Log an error-level message. SignatureParameters
Example
debug
Log a debug-level message. SignatureParameters
Example
Types
InitOptions · IIIError · IIIConnectionState · TriggerRequest · TriggerAction · HttpInvocationConfig · HttpAuthConfig · HttpMethod · Channel · ChannelReader · ChannelWriter · ChannelDirection · StreamChannelRef · FunctionInfo · FunctionRef · TriggerInfo · WorkerInfo · WorkerMetadata · Trigger · RegisterFunctionMessage · RegisterServiceMessage · OtelConfig · ReconnectionConfig
InitOptions
Configuration options passed to [register_worker].
IIIError
Errors returned by the III SDK.IIIConnectionState
Connection state for the III WebSocket clientTriggerRequest
Request object fortrigger(). Matches the Node/Python SDK signature:
trigger({ function_id, payload, action?, timeout_ms? })
TriggerAction
Routing action for [TriggerRequest]. Determines how the engine handles
the invocation.
Enqueue— Routes through a named queue for async processing.Void— Fire-and-forget, no response.
HttpInvocationConfig
Configuration for registering an HTTP-invoked function (Lambda, Cloudflare Workers, etc.) instead of a local handler.HttpAuthConfig
Authentication configuration for HTTP-invoked functions.Hmac— HMAC signature verification using a shared secret.Bearer— Bearer token authentication.ApiKey— API key sent via a custom header.
HttpMethod
Channel
A streaming channel pair for worker-to-worker data transfer.ChannelReader
WebSocket-backed reader for streaming binary data and text messages.ChannelWriter
WebSocket-backed writer for streaming binary data and text messages.ChannelDirection
StreamChannelRef
FunctionInfo
Function information returned byengine::functions::list
FunctionRef
TriggerInfo
Trigger information returned byengine::triggers::list
WorkerInfo
Worker information returned byengine::workers::list
WorkerMetadata
Worker metadata for auto-registrationTrigger
Handle returned byIII::register_trigger.
Call unregister to remove the trigger from the engine.