python-kucoin: ReconnectingWebsocket is not reconnecting
Hi there, I have the issue that the websocket seems to be closed after approx 60 seconds. I subscribed to a 3 tickers and my callback function informs me when it was not called for at least 15 sec. The first minute everything works fine, but then I do not receive messages anymore from the websocket. When I then run ksm.unsubscribe for my tickers, I get:
File "C:/Users/xxxxxxxxxx", line 307, in kunsubscribe
await self.ksm.unsubscribe('/market/ticker:ETH-BTC')
File "C:\ProgramData\Anaconda3\lib\site-packages\kucoin\asyncio\websockets.py", line 239, in unsubscribe
await self._conn.send_message(req_msg)
File "C:\ProgramData\Anaconda3\lib\site-packages\kucoin\asyncio\websockets.py", line 133, in send_message
await self._socket.send(json.dumps(msg))
File "C:\ProgramData\Anaconda3\lib\site-packages\websockets\protocol.py", line 361, in send
yield from self.ensure_open()
File "C:\ProgramData\Anaconda3\lib\site-packages\websockets\protocol.py", line 501, in ensure_open
self.close_code, self.close_reason) from self.transfer_data_exc
ConnectionClosed: WebSocket connection is closed: code = 1006 (connection closed abnormally [internal]), no reason
This error does not appear when I unsubscribe from the websocket before the 1 minute has passed. So altogether it seems the ReconnectingWebsocket class you created does not reconnect in this case as the Websocket connection is down according to the error. Any idea what is wrong?
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 16 (13 by maintainers)
Commits related to this issue
- Merge pull request #59 from MarcelBeining/master fixing send_ping never called (closes #56) — committed to sammchardy/python-kucoin by sammchardy 5 years ago
@MarcelBeining My code fails randomly sometimes after 6 hours and sometimes after 2 days. i have about 99 subscriptions.
For now I use the following code in case it lost the connection:
Small note: I am not the owner of this repository.
@Full4me jep you can. I can subscribe to 100 markets per instance at the moment with the same API and ip