Skip to content

Instantly share code, notes, and snippets.

View SonicDMG's full-sized avatar

David Jones-Gilardi SonicDMG

View GitHub Profile
@SonicDMG
SonicDMG / relay.js
Created April 2, 2025 00:19
An example relay.js to use with OpenAI's realtime websocket console and Langflow in voice TTS mode
// relay.js - WebSocket relay server for text-to-speech functionality
import { WebSocketServer, WebSocket as NodeWebSocket } from 'ws';
import { v4 as uuidv4 } from 'uuid';
/**
* RealtimeRelay - Manages WebSocket connections between a frontend client and Langflow backend
* Primarily handles text-to-speech (TTS) functionality with message queueing and audio response handling
*/
export class RealtimeRelay {
constructor({