Realtime Audio
Realtime Audio
client.realtime opens a bidirectional WebSocket session to wss://api.meshapi.ai/v1/realtime. The wire format is identical to OpenAI’s Realtime API.
Node 22+ has WebSocket built in. On Node 18–21, install the ws package: npm install ws.
Connect
Configure the session
Send audio
Async iterator
The async iterator yields RealtimeMessage objects and throws RealtimeError on server error envelopes:
Callback style
Use on() when you prefer event handlers over iteration:
Close
close() returns a Promise that resolves when the TCP close handshake completes: