Installation
Initialization
registerWorker
Register the worker with a iii instance, returns a connected worker client. The WebSocket connection is established automatically. Signature- Parameters
- Example
Methods
registerTrigger
Registers a new trigger. A trigger is a way to invoke a function when a certain event occurs. Signature- Parameters
- Example
The trigger to register
registerFunction
Registers a new function with a local async handler that runs in the browser session. HTTP invocation configs are a Node.js SDK feature. Signature- Parameters
- Example
trigger
Invokes a function using a request object. Signature- Parameters
- Example
The trigger request containing function_id, payload, and optional action/timeout
registerTriggerType
Registers a new trigger type. A trigger type is a way to invoke a function when a certain event occurs. Signature- Parameters
- Example
unregisterTriggerType
Unregisters a trigger type. Signature- Parameters
- Example
The trigger type to unregister
addConnectionStateListener
Subscribe to connection-state transitions. The handler is fired immediately with the current state, then on every transition. Multiple listeners are supported. Returns an unsubscribe function. Signature- Parameters
- Example
Callback invoked with the new connection state whenever it changes.
shutdown
Gracefully shutdown the iii, cleaning up all resources. SignatureExample
Subpath Exports
Theiii-browser-sdk package provides additional entry points:
Types
iii-browser-sdk
ApiRequest · ApiResponse · AuthInput · AuthResult · Channel · ChannelReader · ChannelWriter · EngineFunctions · EngineTriggers · EnqueueResult · FunctionRef · IIIConnectionState · InitOptions · MessageType · MiddlewareFunctionInput · OnFunctionRegistrationInput · OnFunctionRegistrationResult · OnTriggerRegistrationInput · OnTriggerRegistrationResult · OnTriggerTypeRegistrationInput · OnTriggerTypeRegistrationResult · RegisterFunctionInput · RegisterFunctionMessage · RegisterFunctionOptions · RegisterTriggerInput · RegisterTriggerMessage · RegisterTriggerTypeInput · RegisterTriggerTypeMessage · RemoteFunctionHandler · StreamChannelRef · Trigger · TriggerAction · TriggerConfig · TriggerHandler · TriggerRequest · TriggerTypeRef
ApiRequest
Incoming HTTP request received by a function registered with an HTTP trigger.ApiResponse
Structured API response returned from HTTP function handlers.AuthInput
Input passed to the RBAC auth function during WebSocket upgrade. Contains the HTTP headers, query parameters, and client IP from the connecting worker’s upgrade request.AuthResult
Return value from the RBAC auth function. Controls which functions the authenticated worker can invoke and what context is forwarded to the middleware.Channel
A streaming channel pair for worker-to-worker data transfer. Created via thecreateChannel helper from iii-browser-sdk/helpers.
ChannelReader
Read end of a streaming channel. Uses native browser WebSocket.ChannelWriter
Write end of a streaming channel. Uses native browser WebSocket.EngineFunctions
Engine function paths for internal operations. Naming note:LIST_TRIGGERS / INFO_TRIGGERS cover trigger TYPES
(templates). LIST_REGISTERED_TRIGGERS / INFO_REGISTERED_TRIGGERS
cover trigger INSTANCES (subscriber rows). The old
engine::trigger-types::list builtin has been removed and is now
served by engine::triggers::list.
EngineTriggers
Engine trigger typesEnqueueResult
Result returned when a function is invoked withTriggerAction.Enqueue.
FunctionRef
Handle returned by ISdk.registerFunction. Contains the function’sid and an unregister() method.
IIIConnectionState
Connection state for the III WebSocketInitOptions
Configuration options passed to registerWorker.MessageType
MiddlewareFunctionInput
Input passed to the RBAC middleware function on every function invocation through the RBAC port. The middleware can inspect, modify, or reject the call before it reaches the target function.OnFunctionRegistrationInput
Input passed to theon_function_registration_function_id hook
when a worker attempts to register a function through the RBAC port.
Return an OnFunctionRegistrationResult with the (possibly mapped)
fields, or throw to deny the registration.
OnFunctionRegistrationResult
Result returned from theon_function_registration_function_id hook.
All fields are optional; omitted fields keep the original value from the
registration request.
OnTriggerRegistrationInput
Input passed to theon_trigger_registration_function_id hook
when a worker attempts to register a trigger through the RBAC port.
Return an OnTriggerRegistrationResult with the (possibly mapped)
fields, or throw to deny the registration.
OnTriggerRegistrationResult
Result returned from theon_trigger_registration_function_id hook.
All fields are optional; omitted fields keep the original value from the
registration request.
OnTriggerTypeRegistrationInput
Input passed to theon_trigger_type_registration_function_id hook
when a worker attempts to register a new trigger type through the RBAC port.
Return an OnTriggerTypeRegistrationResult with the (possibly mapped)
fields, or throw to deny the registration.
OnTriggerTypeRegistrationResult
Result returned from theon_trigger_type_registration_function_id hook.
All fields are optional; omitted fields keep the original value from the
registration request.
RegisterFunctionInput
RegisterFunctionMessage
RegisterFunctionOptions
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.
TriggerAction
Factory object that constructs routing actions for ISdk.trigger.TriggerConfig
Configuration passed to a trigger handler when a trigger instance is registered or unregistered.TriggerHandler
Handler interface for custom trigger types. Passed toISdk.registerTriggerType.
TriggerRequest
Request object passed to ISdk.trigger.TriggerTypeRef
Typed handle returned by ISdk.registerTriggerType. Provides convenience methods to register triggers and functions scoped to this trigger type, so callers don’t need to repeat thetype field.
iii-browser-sdk/state
DeleteResult · IState · StateDeleteInput · StateDeleteResult · StateEventData · StateEventType · StateGetInput · StateListInput · StateSetInput · StateSetResult · StateUpdateInput · StateUpdateResult
DeleteResult
Result of a state delete operation.IState
Interface for state management operations. Available via theiii-browser-sdk/state
subpath export.
StateDeleteInput
Input for deleting a state value.StateDeleteResult
Result of a state delete operation.StateEventData
Payload for state change events.StateEventType
Types of state change events.StateGetInput
Input for retrieving a state value.StateListInput
Input for listing all values in a state scope.StateSetInput
Input for setting a state value.StateSetResult
Result of a state set operation.StateUpdateInput
Input for atomically updating a state value.StateUpdateResult
Result of a state update operation.iii-browser-sdk/stream
IStream · MergePath · StreamAuthInput · StreamAuthResult · StreamChangeEvent · StreamContext · StreamDeleteInput · StreamGetInput · StreamJoinLeaveEvent · StreamJoinLeaveTriggerConfig · StreamJoinResult · StreamListGroupsInput · StreamListInput · StreamSetInput · StreamSetResult · StreamTriggerConfig · StreamUpdateInput · StreamUpdateResult · UpdateAppend · UpdateDecrement · UpdateIncrement · UpdateMerge · UpdateOp · UpdateOpError · UpdateRemove · UpdateSet
IStream
Interface for custom stream implementations. Passed toISdk.createStream
to override the engine’s built-in stream storage.
MergePath
Path target for a UpdateMerge op. Accepts:- a single string (legacy / first-level field)
- an array of literal segments (nested path; each element is one literal key, dots are NOT interpreted as separators)
path, pass "", or pass [] to target the root value.
StreamAuthInput
Input for stream authentication.StreamAuthResult
Result of stream authentication.StreamChangeEvent
Handler input forstream triggers, fired when an item changes via stream::set, stream::update, or stream::delete.
StreamContext
Context type extracted from StreamAuthResult.StreamDeleteInput
Input for deleting a stream item.StreamGetInput
Input for retrieving a single stream item.StreamJoinLeaveEvent
Event payload for stream join/leave events.StreamJoinLeaveTriggerConfig
Trigger config forstream:join and stream:leave triggers.
StreamJoinResult
Result of a stream join request.StreamListGroupsInput
Input for listing all groups in a stream.StreamListInput
Input for listing all items in a stream group.StreamSetInput
Input for setting a stream item.StreamSetResult
Result of a stream set operation.StreamTriggerConfig
Trigger config forstream triggers. Filters which item changes fire the handler.
StreamUpdateInput
Input for atomically updating a stream item.StreamUpdateResult
Result of a stream update operation.UpdateAppend
Append an element to an array, concatenate a string, or push a new value at a nested path. The target is the root (whenpath is
omitted, empty, or []), a single first-level key (when path is
a non-empty string), or an arbitrary nested location (when path
is an array of literal segments). See MergePath.
Engine semantics: missing/null intermediates along a nested path are
auto-created; missing leaves on a nested path always become arrays
(no string-concat tier); existing object/scalar leaves return
append.type_mismatch. Each path segment is a literal key,
["a.b"] targets a single key named "a.b", not a → b.
UpdateDecrement
Decrement a numeric field by a given amount.UpdateIncrement
Increment a numeric field by a given amount.UpdateMerge
Shallow-merge an object into the target. The target is the root (whenpath is omitted/empty) or an arbitrary nested location
specified by an array of literal segments. See MergePath.
Validation: invalid paths/values (depth > 32, segment > 256 bytes,
value depth > 16, > 1024 top-level keys, or any
__proto__/constructor/prototype segment or top-level key) are
rejected with a structured error in the response’s errors array.
UpdateOp
Union of all atomic update operations supported by streams.UpdateOpError
Per-op error returned bystate::update / stream::update.