Registry / ai-ml / simli-client

simli-client

JSON →
library3.0.1jsnpmunverified

SimliClient is a WebRTC frontend client designed for real-time interaction with AI-powered facial recognition and avatar services. It enables developers to integrate live audio and video streaming capabilities into their web applications, specifically for scenarios involving AI-driven avatars or face-based interactions. The current stable version is 3.0.1. While a specific release cadence isn't explicitly stated, the package follows semantic versioning, with major version changes (like the jump to v3) indicating significant updates and potential breaking changes. Its primary differentiator is its focus on streamlining the integration of WebRTC with Simli's AI backend for facial analysis and avatar control, abstracting much of the low-level WebRTC API complexity for these specialized use cases.

npm install simli-client
INSTALL
IMPORT
SIG · SIMLI-CLIENT
S
simli-client
ai-mljavascriptv3.0.1
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

SimliClient
import { SimliClient } from 'simli-client';
const SimliClient = require('simli-client');
The library primarily uses ES Modules. Direct CommonJS require() is not supported and will result in a 'SimliClient is not a constructor' or similar error.
SimliClientConfig
import type { SimliClientConfig } from 'simli-client';
Use 'import type' for importing TypeScript interfaces or types to ensure they are stripped from the JavaScript output, preventing runtime errors or unnecessary bundle size increase.
Initialize
await client.Initialize(config);
The `Initialize` method is asynchronous and must be awaited to ensure the client is properly set up before calling `start()` or other methods.

This quickstart demonstrates how to initialize the SimliClient, set up event listeners for connection status, and establish a WebRTC connection. It includes an example of sending dummy audio data after connection and highlights secure API key handling.

import { SimliClient } from 'simli-client'; import type { SimliClientConfig } from 'simli-client'; async function setupSimliConnection() { // In a real application, ensure these values are loaded securely (e.g., environment variables) const SIMLI_API_KEY = process.env.SIMLI_API_KEY ?? 'your-simli-api-key-here'; const SIMLI_SERVER_URL = process.env.SIMLI_SERVER_URL ?? 'wss://your.simli.server.com/ws'; if (SIMLI_API_KEY === 'your-simli-api-key-here') { console.warn("WARNING: Please replace 'your-simli-api-key-here' with your actual Simli API key."); } if (SIMLI_SERVER_URL === 'wss://your.simli.server.com/ws') { console.warn("WARNING: Please replace 'your.simli.server.com' with your actual Simli server URL."); } const config: SimliClientConfig = { apiKey: SIMLI_API_KEY, serverUrl: SIMLI_SERVER_URL, // Optional: avatarId: 'default-avatar', // Optional: logLevel: 'info' // 'debug', 'warn', 'error' }; const client = new SimliClient(); // Attach event listeners for connection status client.on('connected', () => { console.log('SimliClient: Successfully connected to the server.'); // You can start sending data here // For demonstration, let's send dummy audio for 5 seconds const dummyAudio = new Uint8Array(1024).fill(0); let sendCount = 0; const interval = setInterval(() => { if (sendCount < 50) { // Send for 50 * 100ms = 5 seconds client.sendAudioData(dummyAudio); sendCount++; } else { clearInterval(interval); console.log('SimliClient: Finished sending dummy audio data.'); } }, 100); }); client.on('disconnected', () => console.log('SimliClient: Disconnected from the server.')); client.on('failed', (error: Error) => console.error('SimliClient: Connection failed:', error)); try { console.log('SimliClient: Initializing with provided configuration...'); await client.Initialize(config); console.log('SimliClient: Initialization complete. Attempting to start connection...'); await client.start(); // This establishes the WebRTC connection console.log('SimliClient: Connection process initiated.'); // In a real application, you might acquire a MediaStream from getUserMedia // and then use client.listenToMediastreamTrack(audioTrack); } catch (error) { console.error('SimliClient: Fatal error during setup or connection:', error); client.close(); // Ensure resources are cleaned up on failure } } // Execute the setup function setupSimliConnection();
Debug
Known issues
breakingThe jump from version 2.x to 3.x likely introduced breaking changes in API signatures, configuration options, or internal mechanisms. Developers upgrading from previous major versions should consult the official documentation for migration guides.
fix
Refer to the official SimliClient v3 documentation or migration guides (if available) for updated API usage and configuration. Adjust your code to conform to the new v3 interfaces.
affects: >=3.0.0
gotchaAPI keys and sensitive server URLs should never be directly hardcoded into client-side bundles for production applications. Exposure can lead to unauthorized access and abuse of your Simli services.
fix
Use environment variables, a backend API endpoint to proxy credentials, or a secure token exchange mechanism (e.g., JWTs) to provide these values to your client-side application at runtime without embedding them directly.
affects: >=1.0.0
gotchaWebRTC connections can be sensitive to network environments, including firewalls, NAT traversal, and network latency. Users behind restrictive networks may experience connection failures or poor performance.
fix
Ensure your Simli server infrastructure uses appropriate STUN/TURN servers to facilitate connection establishment across various network topologies. Provide clear error messages to users if connection fails due to network issues.
affects: >=1.0.0
gotchaThe `Initialize` and `start` methods are asynchronous. Calling other methods before these operations complete can lead to runtime errors or unexpected behavior as the WebRTC connection might not be ready.
fix
Always `await` the `Initialize` and `start` methods and handle any potential rejections (errors) gracefully. Ensure subsequent API calls are made only after the `connected` event has fired or after these promises resolve.
affects: >=1.0.0
Errors
Common errors & fixes
TypeError: SimliClient is not a constructor
Attempting to import SimliClient using CommonJS 'require' syntax in an ESM-only or hybrid environment where the default export is not correctly handled.
fix
Change your import statement to `import { SimliClient } from 'simli-client';` for ES Module compatibility.
Error: API key is missing or invalid.
The `apiKey` field in the `SimliClientConfig` object was either not provided or contained an empty/invalid string.
fix
Ensure `SimliClientConfig.apiKey` is set to a valid, non-empty API key provided by Simli. Double-check for typos.
SimliClient: Connection failed: Signaling error occurred.
The WebRTC signaling process failed, often due to an unreachable `serverUrl`, incorrect server configuration, or network issues preventing the client from negotiating a connection with the Simli backend.
fix
Verify that `SimliClientConfig.serverUrl` is correct and accessible. Check firewall rules, network connectivity, and the status of your Simli backend server. Inspect console logs for more specific WebSocket or WebRTC errors.
ReferenceError: navigator is not defined
Attempting to use browser-specific APIs like `navigator.mediaDevices.getUserMedia` in a Node.js environment without appropriate polyfills or mocking.
fix
Ensure your code runs in a browser environment or use a tool like JSDOM to mock browser APIs if running unit tests in Node.js. For server-side operations, SimliClient is not typically used directly.
Upgrade
Version history
3.0.1latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
5 hits · last 30 days
node
4
OpenAI (training)
1
Resources