Using WebSockets without interfering with Meteor's own

I’d like to set up a WebSocket connection to stream the microphone input from the client to my Meteor server and then forward it to Amazon Transcribe. What would be the best way to set up a separate WebSocket between client and server without interfering with Meteor’s own WebSocket used for DDP?

1 Like

You will probably use something like ws instead of SockJS, which meteor uses.

Meteor uses the /websocket path, which is no go.

Besides that caveat, I think nowadays, with Express baked in the core, the best way would probably be the best way as someone would do it in a typical express/node setup.

From my search and trying to remember what I did in my previous jobs, I think these two links + this npm package might solve your problem.

2 Likes

Thanks for the links!

I tried ws, as ChatGPT also recommended, but ran into some conflicts with Meteor’s SockJS. So I ended up using WebApp.httpServer instead. This worked, but I had to implement the WebSocket frame parsing myself (assisted by my fellow AI companion).