Hey Guys
What I do:
I stream live camera image data (jpeg encoded as binary) over flask socket-io to a client,
socket message's has a frame and some meta data.
Each emitted message has around ~350KB in total.
When I stream one camera, the socket message's size on chrome devtools show's me the correct size.
Dev tools singel cam
When I stream multiple camera's socket messages are grow sometimes up to 3MB when I log the size on python side it is still around 350KB for each emitted message.
Dev tools multiple cameras
Can anybody explain me why this happen ? Thanks
Code:
This function send on python side the frame
@socket_io.on('frame_request')
def connect(data):
while app.socket_online:
frame = app.dm.get_frame_as_bytes(data["id"])
emit('data', {'meta': app.dm.get_meta_data(data["id"]), 'frame': frame})
socket_io.sleep(1/12)
This function recive the incoming frames
handle_frame(frame) {
var blob = new Blob([frame], {
type: 'image/jpeg'
});
var url_create = window.URL || window.webkitURL;
var imageUrl = url_create.createObjectURL(blob);
this.img = imageUrl;
}
question from:
https://stackoverflow.com/questions/65617329/flask-socket-io-need-help-to-understand-why-message-grows-in-size 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…