#30220·ccxt

CCXT Pro drops buffered WebSocket updates between watch calls

Author: embogomolovCreated Sep 2, 2026Updated Sep 27, 2026
Labelsbugws

Operating System

macOS

Programming Language

Python

CCXT Version

4.5.77

Description

When two messages with the same message hash are processed in one event-loop turn, only the first reaches the watcher.

Client.resolve() removes the future after the first message. receive_loop() may process another buffered frame before the coroutine registers a new future, so the second result is discarded.

Steps to Reproduce

python
import asyncio

from ccxt.async_support.base.ws.client import Client


async def main():
    callback = lambda *_: None
    client = Client(
        "wss://example.invalid",
        callback,
        callback,
        callback,
        callback,
    )

    async def consume():
        first = await client.future("positions")
        second = await client.future("positions")
        return [first, second]

    consumer = asyncio.create_task(consume())
    await asyncio.sleep(0)

    client.resolve("first", "positions")
    client.resolve("second", "positions")

    try:
        print(await asyncio.wait_for(consumer, 0.1))
    except TimeoutError:
        print("second update was dropped")


asyncio.run(main())

Expected Behavior

['first', 'second']

Actual Behavior

second update was dropped

Additional Observations

I found this with Bybit watch_positions() when several private messages arrived in one burst.