Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个到服务器的 websocket 连接,每次值更改时都会不断发送消息。然后我对该值进行一些操作并再次检查消息。问题是有时我对消息执行的操作花费的时间太长,当我回来阅读消息时,队列中实际上有 2 或 3 个。但是,我只对最新消息感兴趣,因为那是最新的值。有没有办法告诉 websocket:“只显示最新消息?”
我曾考虑过使用 LIFO 队列,但我不知道它们有多快。
谢谢!