You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using the branch feature/asyncio and it works well.
However, due to binance deconneciton of the websocket, I sometime recieved following messages:
ERROR code = 1006 (connection closed abnormally [internal]), no reason
websockets.protocol DEBUG client ! timed out waiting for pong
and it seems that the API does not reconnect correctly.
I tried to reproduce it using following snippet:
import asyncio
from binance import AsyncClient, BinanceSocketManager
import logging
from logs_management import logToConsole
logToConsole(logging.INFO)
loop = None
async def main():
global loop
# initialise the client
client = await AsyncClient.create()
# initialise socket manager
bsm = BinanceSocketManager(client, loop)
# setup async callback handler for socket messages
async def handle_evt(msg):
pair = msg['s']
print(f'{pair} : {msg}')
# create listener, can use the `ethkey` value to close the socket later
key = await bsm.start_aggtrade_socket('BTCUSDT', handle_evt)
while True:
print("doing a sleep")
await asyncio.sleep(20, loop=loop)
Hello,
I'm using the branch feature/asyncio and it works well.
However, due to binance deconneciton of the websocket, I sometime recieved following messages:
and it seems that the API does not reconnect correctly.
I tried to reproduce it using following snippet:
import asyncio
from binance import AsyncClient, BinanceSocketManager
import logging
from logs_management import logToConsole
logToConsole(logging.INFO)
loop = None
async def main():
global loop
if name == "main":
The API tries to reconnect, I see the following line in DEBUG mode:
'websocket btcusdt@aggTrade reconnecting 4 reconnects left'
but it never manages to reconnect and the loop continues to write "doing a sleep" with nothing else.
investing in the file websocket.py, it seems that the line
'asyncio.sleep(reconnect_wait)'
never finish.
Could you please inestigate and help me to fix this issue?
Thanks a lot,
Cyrille.
Environment (please complete the following information):
The text was updated successfully, but these errors were encountered: