'LIFO Receiver for a websocket connection

I have a websocket that is constantly pushing messages, faster than I can read. I only want to grab the latest ones and ignore all the others.

I am looking for a library that works like a Receiver but is LIFO (Instead of FIFO) but I could not find it.

What suggestion do you have?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source