Realtime API causing disconnects from SocketIO after response

I’m running a Flask-SocketIO server with eventlet and using the Realtime API to send/receive messages to my client. I’ve got it to work both with ‘conversation.item.create’ sending users full audio per button press to start/stop recording and I’ve used ‘input_audio_buffer.append’ for realtime audio streaming.

My server disconnects using both methods. The first will send audio response then disconnect afterwards, while the realtime stream will stop mid response and disconnect.

It’s driving me crazy trying to figure out if it’s the API, something I’m doing wrong, or if this behavior is inherit to streaming audio using eventlet as I’ve read somewhere else.

Anyone else having this experience? I’ve gotten this far but I feel like I’ve hit a wall now. (My expertise is not in backend servers so I’m not the most familiar with the details of these tools) and the documentation/examples for websockets + chat completion for the API is lacking at the moment. Any help appreciated.

Is this just where the Realtime API is in the Beta currently? Should I put in the effort to store the session ID and re-establish the connection after each response?

1 Like