As I receive multiple streams from a Socket, my goal is to extract the most recent item.
While distinctUntilChanged
function typically selects the first item, in this case, I need to reverse this behavior somehow.
To achieve this using rxjs, I am aiming to transform the stream as follows:
In: 1 - 1 - 1 - 2 - 2 - 3 - 3 - 1 - 1 - 1 - 2 - 2 - 2 - 1 - 2 - 2 - 3 - 3
Out: - - - - 1 - - - 2 - - - 3 - - - - - 1 - - - - - 2 - 1 - - - 2 - 3 - -