Websockets connect, immediately close.

Hey there!
My last post about this was deleted, probably because it was burried under the recent spam. If there actually is an issue with my post that would make it innappropriate for this forum, let me know.

Now to my issue: I’m trying to run the recent Twilio + OpenAI Realtime Example in IDX. It basically runs a JS server with a websocket endpoint. An external service (in this case Twilio) connects to it and sends messages to it.

This works fine if I run the server locally and use ngrok to expose it to the web.
However, it doesn’t work in IDX. I have set the port to public, and the requests actually do come through, but the connection is immediately closed again, with a 1006 close code. From Twilio’s side I get the following error message: “The server has returned an HTTP code different from 101 to the connection request sent by stream”.

Is there anything I need to do from my side in addition to making the port public? Or is that simply a bug on IDX side, and I can’t do anything to work around it?

1 Like

Tagging @Prakhar and @Chandra_Sekhar_Pydi who may have some insights here or ask for more details if there is a bug on our end we’ll need to investigate :slight_smile:

1 Like

Got the same issue with trying to create a websocket with the “ws” module between my idx app and discord activity. Worked fine when I tested it between my browser and the idx app, but when testing it between idx and the discord activity, it connects and immediately disconnects with the 1006 code as OP stated. Tried using socket.io too, but it logged nothing at all.