coinbasepro-python icon indicating copy to clipboard operation
coinbasepro-python copied to clipboard

Websocket forcibly closed by remote host

Open simaster123 opened this issue 6 years ago • 11 comments

Hi All,

Is anyone else receiving the following when using the websockets / have any recommended solutions?

[WinError 10054] An existing connection was forcibly closed by the remote host - data: None

My websocket connection seems to perform fine for about 20 seconds, and then this error occurs.

Thanks in advance!

simaster123 avatar Apr 24 '19 11:04 simaster123

Update - It looks like installing cbpro through pip does not provide the most up-to-date websocket_client.py. I copied and pasted the code available here in GitHub into package websocket_client.py file from pip; that appears to have resolved the issue.

simaster123 avatar Apr 24 '19 11:04 simaster123

Further update - while the current code available on GitHub stops the issue from occurring every couple minutes, I'm still encountering the issue every 30 minutes or so. I've added a auto-reconnect workaround when the error is encountered, but it's obviously not ideal. Anyone know what is causing the error in the first place?

simaster123 avatar Apr 25 '19 11:04 simaster123

Yes its an issue we encountered. Reconnecting didn't help because sometimes it disconnected very quickly (within seconds) without even telling you right ? Because this is my case. Did you try from scratch with the native coinbase WS api to get the data ?

edmondja avatar May 01 '19 12:05 edmondja

Same issue re: disconnecting without telling you, although most of my disconnects are of the type in my prompt - forcibly closed. I added some additional checks in my code to confirm whether messages are being received. It can be a couple minutes before I'm able to re-establish a somewhat stable connection. I haven't tried from scratch yet. Any ideas as to what's causing the issues?

simaster123 avatar May 03 '19 01:05 simaster123

Are you still seeing this issue @simaster123 ?

mcardillo55 avatar Nov 22 '20 11:11 mcardillo55

Seeing a similar issue - created a new one before I noticed this

sundarkast avatar Dec 15 '20 17:12 sundarkast

websocket_client.py

Which one is being used?

ls -al /usr/local/lib/python3.6/dist-packages/cbpro/websocket_client.py 4812 Dec 12 23:01 /usr/local/lib/python3.6/dist-packages/cbpro/websocket_client.py ls -al /usr/local/lib/python3.6/dist-packages/gdax/websocket_client.py 3187 Dec 12 23:01 /usr/local/lib/python3.6/dist-packages/gdax/websocket_client.py

sundarkast avatar Dec 15 '20 17:12 sundarkast

I am also wrestling with this error. It didn't seem to be a problem when I was subscribed to the ticker channel, but every since I started using level 2 it has become a problem.

pbpunk avatar Mar 15 '21 17:03 pbpunk

Is this the same as #341? If so, I too am experiencing the issue.

jacobfrank250 avatar Mar 29 '21 15:03 jacobfrank250

Connecting constantly is the only sure solution. And then it is simply necessary to build a technical solution that does not fail on an occasional missed message. Lets say you miss one message out of 1000. Should that interfere with your trading set-up? Lets hope not. The system must be robust enough to handle outages from time to time, because they do happen for a variety of reasons.

noah222 avatar Mar 29 '21 15:03 noah222

Also, there is no reason to use the cbpro websocket client. To me it seems clunky. Make your own connections using websocket for better control of the process. Its only a few lines of code to subscribe and resubscribe at will. Then find a way (hint, memcashe) to keep the feed running in its own window for monitoring so it can be restarted when problems arise. Thats all I can say about the feed. It seems silly to be connecting all the time, but thats how you ensure it works with these limited tools.

noah222 avatar Mar 29 '21 15:03 noah222