I’m building a real-time appointment scheduling system using the OpenAI Realtime API with WebSocket connections. The flow works as follows:
- The user requests to schedule an appointment.
- The AI assistant asks for the date and calls the
getAvailableSlots
function. - The available time slots are returned and displayed to the user.
- The user is prompted to select a time slot.
However, the WebSocket connection disconnects (Close Code: 1000
) after returning the available time slots, preventing the user from selecting a slot and proceeding to the scheduleAppointment
step.
Key Observations:
- The WebSocket connection remains open until the
getAvailableSlots
function completes. - After returning the time slots, the connection closes before the user can respond.
- The
keepAliveInterval
is set to 25 seconds, but the connection still drops. - There are no errors in the logs, and the disconnection appears to be intentional.