I'm trying to test an implementation of webcam streaming through socket-io.
I thought that socket-io could handle many requests per second but my flask server crash when I exceed about 20 call per second to my socket-io listener.
Here is the code in my website :
setInterval(() => {
socket.emit(
"frame2server",
`It is currently ${Date.now()}!`
);
}, 50); // 50ms = 20 fps
And here is the socket-io code :
@socketio.on("frame2server")
def handle_frame(frame):
socketio.emit("frame2client", frame)
Any ideas on the subject ?
CodePudding user response:
It's because socket-io limits by default the number of calls per second. To fix that, you need to add :
from engineio.payload import Payload
Payload.max_decode_packets = 50