uNetworking/uWebSockets.js

How to reduce real-time audio and video stream forwarding delay?

youfeed opened this issue · 4 comments

My business uses pub/sub format to forward calls between both parties.

How to get only the latest push on the sub side and allow discarding part of the old stream to ensure the lowest delay

  app.ws('/pull/:uuid',{
    compression: uWS.SHARED_COMPRESSOR,
    idleTimeout: 60,
    maxBackpressure: 64 * 1024 * 1024,
    maxPayloadLength: 64 * 1024 * 1024,
    sendPingsAutomatically:true
   .........
})

Websockets are TCP so already you have kind of the wrong protocol for video calls. But you can lower max backpressure and TCP socket send buffer sizes to allow the lib to skip old data

I'll try

maxBackpressure: 1024,

wait me back

You also need to set the kernel TCP send buffer size small

image
ws:/push/:uuid Used to push binary messages to the pull channel
ws:/pull/:uuid Specifically used to subscribe to channels

He is slower now