@trelis/converse
v0.4.5
Published
Browser SDK for the Trelis Converse v2.1 WebSocket voice API
Maintainers
Readme
@trelis/converse
The browser SDK for the Converse realtime voice API. It owns microphone capture, echo cancellation, streaming playback, interruptions and reconnects.
npm install @trelis/converseKeep your persistent ck_… API key on your backend. Exchange it for a scoped browser credential
with POST /api/v1/session-keys, then connect from a user gesture:
import { ConverseClient } from '@trelis/converse';
const credential = await fetch('/voice/session', {
method: 'POST',
credentials: 'same-origin',
}).then((response) => {
if (!response.ok) throw new Error(`Voice credential failed: ${response.status}`);
return response.json();
});
const client = new ConverseClient({
url: 'wss://converse.trelis.com/ws',
sessionId: credential.session_id,
apiKey: credential.api_key,
mode: { kind: 'converse' },
});
startButton.addEventListener('click', async () => {
await client.unlockAudio();
await client.connect();
await client.startMic();
});Browser setup and events are in the browser guide. Wire-level playback and tools are in the WebSocket guide.
Proprietary software. All rights reserved.
Repository development
package.json is the version source and CHANGELOG.md records compatibility changes. Production
uses the checked-in copy under web/vendor/converse/.
Before release, run:
npm test
npm run vendor:check
npm run pack:check