Skip to main content

run_pump

Function run_pump 

pub async fn run_pump<C, F, Fut>(
    core: Arc<Mutex<C>>,
    emitter: Arc<Emitter>,
    rx: AsyncReceiver<WsIncoming>,
    cancel: CancellationToken,
    before: F,
)
where C: BrokerCore<Frame = WsIncoming>, F: Fn(WsIncoming) -> Fut, Fut: Future<Output = WsIncoming>,
Expand description

Runs an event pump until cancel fires or the frame channel closes.

Every frame from rx goes through core and the resulting events to emitter. before runs first for each frame (the user data connector uses it to look up what a frame needs). Events that a slow bot left in the subscription buffers are offered again every 20 ms.