// Connect to the STT server and print transcript text only. // Usage: node transcripts.mjs const PORT = process.env.STT_PORT ?? '11501' const ws = new WebSocket(`ws://localhost:${PORT}`) ws.addEventListener('open', () => { process.stderr.write(`connected to ws://localhost:${PORT}\n`) }) ws.addEventListener('message', ({ data }) => { const event = JSON.parse(data) if (event.event === 'transcript') { console.log(event.text) } }) ws.addEventListener('close', () => process.exit(0)) ws.addEventListener('error', () => process.exit(1))