Skip to main content

Installation

Initialization

Creates and returns a connected SDK instance. The WebSocket connection is established automatically — there is no separate connect() 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. Signature

Parameters

Example

createStream

Creates a new stream implementation. This overrides the default stream implementation. Signature

Parameters

Example

listFunctions

Lists all registered functions. Signature

Example

listTriggers

Lists all registered triggers. Signature

Parameters

onFunctionsAvailable

Registers a callback to receive the current functions list when the engine announces changes. Signature

Parameters

Example

registerFunction

Signature

Parameters

registerService

Registers a new service. Signature

Parameters

registerTrigger

Registers a new trigger. A trigger is a way to invoke a function when a certain event occurs. Signature

Parameters

Example

registerTriggerType

Registers a new trigger type. A trigger type is a way to invoke a function when a certain event occurs. Signature

Parameters

Example

shutdown

Gracefully shutdown the iii, cleaning up all resources. Signature

Example

trigger

Invokes a function using a request object. Signature

Parameters

Example

unregisterTriggerType

Unregisters a trigger type. Signature

Parameters

Example

Subpath Exports

The iii-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 to console.*. 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. Signature

Parameters

Example

error

Log an error-level message. Signature

Parameters

Example

info

Log an info-level message. Signature

Parameters

Example

warn

Log a warning-level message. Signature

Parameters

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.js Readable stream for binary data and an onMessage callback for structured text messages.

ChannelWriter

Write end of a streaming channel. Provides both a Node.js Writable 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’s id 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. Use unregister() to remove the trigger from the engine.

TriggerHandler

Handler interface for custom trigger types. Passed to ISdk.registerTriggerType.

TriggerInfo

Information about a registered trigger.

TriggerRequest

Request object passed to ISdk.trigger.

IStream

Interface for custom stream implementations. Passed to ISdk.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 behavior

OtelConfig

Configuration for OpenTelemetry initialization.

ReconnectionConfig

Configuration for WebSocket reconnection behavior

FunctionInfo

Metadata about a registered function, returned by ISdk.listFunctions.

FunctionsAvailableCallback

RegisterFunctionFormat