Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/iii-hq/sdk/llms.txt

Use this file to discover all available pages before exploring further.

The InitOptions type allows you to customize the behavior of the III SDK when connecting to the engine.

Type Definition

type InitOptions = {
  workerName?: string
  enableMetricsReporting?: boolean
  invocationTimeoutMs?: number
  reconnectionConfig?: Partial<IIIReconnectionConfig>
  otel?: Omit<OtelConfig, 'engineWsUrl'>
  telemetry?: TelemetryOptions
}

Fields

Usage Examples

Basic Initialization

import { init } from '@iii/sdk'

const iii = init('ws://localhost:49134')

Custom Worker Name

const iii = init('ws://localhost:49134', {
  workerName: 'payment-processor-1'
})

Custom Timeout

const iii = init('ws://localhost:49134', {
  invocationTimeoutMs: 60000 // 60 seconds
})

Disable Telemetry

const iii = init('ws://localhost:49134', {
  otel: {
    enabled: false
  }
})

Custom Reconnection Behavior

const iii = init('ws://localhost:49134', {
  reconnectionConfig: {
    initialDelayMs: 500,
    maxDelayMs: 10000,
    backoffMultiplier: 1.5,
    maxRetries: 10
  }
})

Full Configuration

import { init } from '@iii/sdk'
import { PrismaInstrumentation } from '@prisma/instrumentation'

const iii = init('ws://localhost:49134', {
  workerName: 'api-server-1',
  enableMetricsReporting: true,
  invocationTimeoutMs: 30000,
  reconnectionConfig: {
    initialDelayMs: 1000,
    maxDelayMs: 30000,
    backoffMultiplier: 2,
    jitterFactor: 0.3,
    maxRetries: -1 // infinite
  },
  otel: {
    enabled: true,
    serviceName: 'my-api',
    serviceVersion: '1.0.0',
    serviceNamespace: 'production',
    instrumentations: [new PrismaInstrumentation()],
    metricsEnabled: true,
    metricsExportIntervalMs: 60000,
    fetchInstrumentationEnabled: true
  },
  telemetry: {
    language: 'en-US',
    project_name: 'my-project',
    framework: 'express'
  }
})

Environment Variables

Many options can also be configured via environment variables:
  • III_BRIDGE_URL - Engine WebSocket URL
  • OTEL_ENABLED - Enable/disable OpenTelemetry (true/false)
  • OTEL_SERVICE_NAME - Service name for telemetry
  • SERVICE_VERSION - Service version
  • SERVICE_NAMESPACE - Service namespace
  • SERVICE_INSTANCE_ID - Service instance ID
  • OTEL_METRICS_ENABLED - Enable/disable metrics

Build docs developers (and LLMs) love