Hi!
I’m developing a website that connects to OpenAI’s real-time speech-to-speech model to build a speech AI assistant. I’ve successfully implemented the audio streaming part, but I’m having trouble receiving messages on the data channel from OpenAI. This is critical because I need those messages to trigger other functions. The data channel was working fine last week, but now, after resuming development, it’s no longer receiving messages.
For reference, I’ve created a valid data channel and confirmed it opens correctly with:
dataChannel.onopen = () => {
console.log('Data channel opened');
};
However, the dataChannel.onmessage
event handler is not being triggered. My code looks like this:
dataChannel.onmessage = async (event) => {
try {
const realtimeEvent = JSON.parse(event.data);
console.log('Received realtime event:', realtimeEvent);
} catch (error) {
console.error('Error parsing realtime event:', error);
}
};
Has there been any recent change to the API or service? Is anyone else experiencing this issue?