1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Anuncie Aqui
    Anuncie aqui você Também: fdantas@4each.com.br

[Python] How can I check the Websocket data is empty by using asyncio

Discussão em 'Python' iniciado por Stack, Julho 10, 2025.

  1. Stack

    Stack Membro Participativo

    I am use python asyncio to create a websocket client, however, when I try the following code, it hangs up

    message = b''
    while True:
    print(11111)
    chunk = await reader.read(1024)
    print(len(chunk))
    self.message += chunk
    print(self.connection['reader'].at_eof())
    if not chunk:
    break
    print('eeeeeeee')


    However, it hangs up and output:

    11111

    35

    False

    How can I check if the buffer is end?

    Continue reading...

Compartilhe esta Página