Answer the question
In order to leave comments, you need to log in
How to remove the delay in receiving data when connecting via web-scoket?
Good day!
from websocket import create_connection
import orjson
config = {
"cmd": "subscribe",
"auth_key": "xxxxxxxxxxxxx",
"needed_bk": ["winline:live"],
}
request = orjson.dumps(config)
try:
ws = create_connection("ws://echo.websocket.org/")
except ConnectionError as err:
print(err)
else:
ws.send(request)
result = ws.recv()
print(result if "cs" in result.replace("[]", "").split(",")[8] else None)
finally:
ws.close()
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question