python - aiohttp - 如何查看 websocket 消息缓冲区?

标签 python python-3.x websocket python-asyncio aiohttp

不幸的是,这个库的文档相当有限,我可以找到对 websocket 消息缓冲区的暗示,但没有访问它的方法。

有谁知道如何查看连接当前收到但尚未传递到“async for msg in ws:”循环的消息?

即模块内部使用的缓冲区,用于操作以下代码中的内部循环:

async with session.ws_connect('wss://example.com') as ws:
    async for msg in ws:
        print(msg)

最佳答案

aiohttp 没有用于访问 Websocket 消息的内部缓冲区的公共(public) API。唯一可用的方法是 async for msg in ws:msg = wait.receive()

内部缓冲区是一个实现细节,代码将来可能会更改。

关于python - aiohttp - 如何查看 websocket 消息缓冲区?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49569283/

相关文章:

python-3.x - 使用 Spacy 创建常见问题解答机器人的过程是什么?

python - 如何创建来自机器人的嵌入消息?

java - Tomcat对javax.websocket.Session#getOpenSessions的解读

python - 如何在两个 Pandas DataFrame 对象上执行 SQL 样式不相交或设置差异?

python - 模糊搜索 Pandas 中的列

python - PyQt matplotlib 在图片顶部绘制轮廓数据 - 缩放问题

Python:修改.cfg文件中的部分字符串

java - 尝试创建新的 Jetty WebSocketClient 实例时抛出 ServiceConfigurationError

java - OutOfMemoryError : Direct buffer memory when using websockets in WildFly

python - 找到 2D 中最小重叠共享表面