P
P
piatachki2020-09-11 20:13:42
Angular
piatachki, 2020-09-11 20:13:42

How to collapse events in RXJS stream by time?

Please tell a newbie.

There is a stream that generates events extremely unevenly - it can be silent for a minute, and then 100 events per second. I want to split events into time intervals and skip only the last event in the interval (if they were in the interval at all).

Judging by the documentation, windowsTime(500) should break the stream into substreams of 0.5 seconds. Created a structure:

.pipe(
        windowTime(500),
        takeLast(1),
        concatAll()
      ).subscribe(...)


in the expectation that windowTime will beat the stream into intervals, takeLast will take the last value from each interval, and concatAll will merge them all again.

Does not work - the callback does not twitch. Tell me, please, where is the error?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anton Shvets, 2020-09-11
@piatachki

auditTime, as far as I understood from the description.
no collapses needed, takeLast and concatAll don't work like that at all

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question