How do I build an MJPEG server via WebSocket on ESP32 using Mongoose
I want to build a MJPEG server via websocket on esp32 in esp idf
The problem is that I am using the mongoose network stack, and
I have to know exactly how would the ws header look like
After some searching, I found that I need data:image/jpeg;base64,
and I did this :
unfortunately, nothing shows up. I have to mention that the basic text communication and the frame read are functioning4 Replies
Hey @te0 as you are sending a header as text and the frame as binary, maybe the WebSocket client might not be handling these frames together as you expect it to do so.
But do you know that MJPEG actually doesn't require base64 encoding, and using base64 can increase the size unnecessarily
You really don’t need the
data:image/jpeg;base64
prefix for WebSocket communication that's unless you're embedding the image directly in HTML or working with Data URLs. Instead, send the raw JPEG frames directly as binary data over the WebSocketSort of like :
mg_ws_send(c, frame_buf->buf, frame_buf->len, WEBSOCKET_OP_BINARY);
thanks I solved it