Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Implement a Python WebSocket listener without async/asyncio

I'm running a websocket listener in a separate thread. I'd like to connect to the websocket then do:

while True:
    msg = sock.wait_for_message()
    f(msg)

i.e. no async/asyncio

Is this stupid? Is there a way to do this?

like image 822
P i Avatar asked Sep 17 '25 02:09

P i


1 Answers

In absence of a better answer, I have found https://github.com/websocket-client/websocket-client which prove painless to use.

like image 178
P i Avatar answered Sep 19 '25 08:09

P i