// Similar to notify_user, but instead of associating an account Uuid with a sender,
// it only assumes control of the store's all payment notification receiver; its messages
// are published alongside account-specific notifications and the dedicated thread
// owns the applicable sender.
Similar to notify_user, but instead of associating an account Uuid with a sender,
it only assumes control of the store's all payment notification receiver; its messages
are published alongside account-specific notifications and the dedicated thread
owns the applicable sender.
Similar to notify_user but instead of associating an account Uuid with a sender it only assumes control of the store ' s all payment notification receiver ; its messages are published alongside account - specific notifications and the dedicated thread owns the applicable sender .
fn notify_all_payments(
    ws_tx: futures::stream::SplitSink<warp::ws::WebSocket, warp::ws::Message>,
    store: impl StreamNotificationsStore,
) -> impl Future<Output = Result<(), ()>> {
    let rx = tokio_stream::wrappers::BroadcastStream::new(store.all_payment_subscription());
    let rx = rx.map(|notification: _| {
        let msg = serde_json::to_string(&notification.map_err(|e| e.to_string())).unwrap();
        Ok(warp::ws::Message::text(msg))
    });
    rx.forward(ws_tx)
        .map(|result| {
            if let Err(e) = result {
                eprintln!("websocket send error: {}", e);
            }
        })
        .then(futures::future::ok)
}
fn notify_all_payments ( ws_tx : futures :: stream :: SplitSink < warp :: ws :: WebSocket , warp :: ws :: Message > , store : impl StreamNotificationsStore , ) -> impl Future < Output = Result < ( ) , ( ) > > { let rx = tokio_stream :: wrappers :: BroadcastStream :: new ( store . all_payment_subscription ( ) ) ; let rx = rx . map ( | notification : _ | { let msg = serde_json :: to_string ( & notification . map_err ( | e | e . to_string ( ) ) ) . unwrap ( ) ; Ok ( warp :: ws :: Message :: text ( msg ) ) } ) ; rx . forward ( ws_tx ) . map ( | result | { if let Err ( e ) = result { eprintln ! ( " " e ) ; } } ) . then ( futures :: future :: ok ) }
Similar to notify_user, but instead of associating an account Uuid with a sender,
it only assumes control of the store's all payment notification receiver; its messages
are published alongside account-specific notifications and the dedicated thread
owns the applicable sender.
Similar to notify_user but instead of associating an account Uuid with a sender it only assumes control of the store ' s all payment notification receiver ; its messages are published alongside account - specific notifications and the dedicated thread owns the applicable sender .
ws_tx
futures::stream::SplitSink<warp::ws::WebSocket, warp::ws::Message>
store
impl StreamNotificationsStore