Configuration
The Advanced iMessage Kit SDK is configured when you initialize it using theSDK() function. All configuration options are passed through the ClientConfig interface.
Basic Configuration
Minimal configuration to connect to a local server:ClientConfig Interface
All configuration options available for the SDK client:The URL of the Advanced iMessage Kit server.This is the base URL where your server is running. For local development, this is typically
http://localhost:1234. For remote servers, use the full URL including protocol and port.Optional API key for authentication.If your server is configured to require API key authentication, provide it here. The API key is sent in the
X-API-Key header for HTTP requests and in the Socket.IO auth payload for WebSocket connections.Without an API key, the SDK operates in “legacy mode” for servers that don’t require authentication. The
ready event will fire immediately upon connection.The logging level for the SDK.Controls the verbosity of log output:
debug- All logs including detailed debugging informationinfo- Informational messages, warnings, and errorswarn- Only warnings and errorserror- Only errors
Whether to write logs to a file.When enabled, the SDK writes logs to a file in addition to console output. Disable this in serverless or containerized environments where file system access is limited.
File logging is useful for debugging production issues, but may consume disk space over time.
Configuration Examples
Development Configuration
For local development with detailed logging:Production Configuration
For production with environment variables and error-level logging:Remote Server Configuration
Connecting to a remote server with authentication:TypeScript Configuration
Full type safety with TypeScript:Environment Variables
Use environment variables for flexible configuration across environments:Singleton Pattern
The SDK uses a singleton pattern - callingSDK() multiple times returns the same instance:
You can also use
AdvancedIMessageKit.getInstance() directly for the same behavior. The SDK() export is a convenience wrapper around this method.Advanced: Direct Instantiation
For advanced use cases where you need multiple instances (not recommended for most applications):Connection Configuration
The SDK automatically configures the Socket.IO connection with optimal settings:- Transport: WebSocket-only (polling disabled to prevent message duplication)
- Timeout: 10 seconds to avoid frequent reconnections
- Reconnection: Enabled with exponential backoff (100ms - 2000ms)
- Force New: Ensures fresh connections to avoid state pollution
Next Steps
Quick Start
Build your first integration with the configured SDK
API Reference
Explore all available methods and modules
Events
Learn about event handling and real-time updates
Examples
See configuration in action with real examples