Installation
Initialization
Creates and returns a connected SDK instance. The WebSocket connection is established automatically — there is no separateconnect() call.
Methods
createChannel
Creates a streaming channel pair for worker-to-worker data transfer. Returns a Channel with a local writer/reader and serializable refs that can be passed as fields in the invocation data to other functions. SignatureParameters
Example
createStream
Creates a new stream implementation. This overrides the default stream implementation. SignatureParameters
Example
listFunctions
Lists all registered functions. SignatureExample
listTriggers
Lists all registered triggers. SignatureParameters
onFunctionsAvailable
Registers a callback to receive the current functions list when the engine announces changes. SignatureParameters
Example
registerFunction
SignatureParameters
registerService
Registers a new service. SignatureParameters
registerTrigger
Registers a new trigger. A trigger is a way to invoke a function when a certain event occurs. SignatureParameters
Example
registerTriggerType
Registers a new trigger type. A trigger type is a way to invoke a function when a certain event occurs. SignatureParameters
Example
shutdown
Gracefully shutdown the iii, cleaning up all resources. SignatureExample
trigger
Invokes a function using a request object. SignatureParameters
Example
unregisterTriggerType
Unregisters a trigger type. SignatureParameters
Example
Subpath Exports
Theiii-sdk package provides additional entry points:
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 toconsole.*.
Pass structured data as the second argument to any log method. Using an
object of key-value pairs (instead of string interpolation) lets you
filter, aggregate, and build dashboards in your observability backend.
debug
Log a debug-level message. SignatureParameters
Example
error
Log an error-level message. SignatureParameters
Example
info
Log an info-level message. SignatureParameters
Example
warn
Log a warning-level message. SignatureParameters
Example
Types
MessageType · ChannelReader · ChannelWriter · Channel · FunctionRef · HttpAuthConfig · HttpInvocationConfig · InitOptions · RegisterFunctionInput · RegisterFunctionMessage · RegisterServiceInput · RegisterTriggerInput · RegisterTriggerMessage · RegisterTriggerTypeInput · RegisterTriggerTypeMessage · RemoteFunctionHandler · StreamChannelRef · Trigger · TriggerHandler · TriggerInfo · TriggerRequest · IStream · DeleteResult · StreamSetResult · StreamUpdateResult · DeleteResult · IIIReconnectionConfig · OtelConfig · ReconnectionConfig · FunctionInfo · FunctionsAvailableCallback · RegisterFunctionFormat
MessageType
ChannelReader
Read end of a streaming channel. Provides both a Node.jsReadable stream
for binary data and an onMessage callback for structured text messages.
ChannelWriter
Write end of a streaming channel. Provides both a Node.jsWritable stream
and a sendMessage method for sending structured text messages.
Channel
A streaming channel pair for worker-to-worker data transfer. Created via ISdk.createChannel.FunctionRef
Handle returned by ISdk.registerFunction. Contains the function’sid and an unregister() method.
HttpAuthConfig
Authentication configuration for HTTP-invoked functions.hmac— HMAC signature verification using a shared secret.bearer— Bearer token authentication.api_key— API key sent via a custom header.
HttpInvocationConfig
Configuration for registering an HTTP-invoked function (Lambda, Cloudflare Workers, etc.) instead of a local handler.InitOptions
Configuration options passed to registerWorker.RegisterFunctionInput
RegisterFunctionMessage
RegisterServiceInput
RegisterTriggerInput
RegisterTriggerMessage
RegisterTriggerTypeInput
RegisterTriggerTypeMessage
RemoteFunctionHandler
Async function handler for a registered function. Receives the invocation payload and returns the result.StreamChannelRef
Serializable reference to one end of a streaming channel. Can be included in invocation payloads to pass channel endpoints between workers.Trigger
Handle returned by ISdk.registerTrigger. Useunregister() to
remove the trigger from the engine.
TriggerHandler
Handler interface for custom trigger types. Passed toISdk.registerTriggerType.
TriggerInfo
Information about a registered trigger.TriggerRequest
Request object passed to ISdk.trigger.IStream
Interface for custom stream implementations. Passed toISdk.createStream
to override the engine’s built-in stream storage.
DeleteResult
Result of a stream delete operation.StreamSetResult
Result of a stream set operation.StreamUpdateResult
Result of a stream update operation.DeleteResult
Result of a state delete operation.IIIReconnectionConfig
Configuration for WebSocket reconnection behaviorOtelConfig
Configuration for OpenTelemetry initialization.ReconnectionConfig
Configuration for WebSocket reconnection behaviorFunctionInfo
Metadata about a registered function, returned byISdk.listFunctions.