Streaming Audio over Websocket using Mongoose

Hello everyone,

I’m trying to do a very simple exemple of streaming the input of my soundcard directly through websocket, using mongoose c++.
For the moment, I naively send chunks from the audiocallback loop.
I’m receiving data on the other side but mongoose is not thread safe, so accessing mongoose functions in the audio callback loop make the connection to break sometimes.

I don’t know how to solve this thread problem. Does someone have an idea ?
Thank you very much for your help !


It’s a reasonably complex problem. I would suggest searching this forum for posts related to network audio. You can check out the posts here and here to get started. Good luck!