Error: Connection aborted, 'ECONNRESET', 104

Q: Why I’m getting an error message with ‘ECONNRESET’?
For example in Python: ('Connection aborted.', OSError("(104, )",))

ECONNRESET is a generic connection protocol error that is bound to happen eventually when using the REST or Streaming API (websocket). The cause can be numerous, including but not limited to:

  • The websocket session was not kept alive;
  • The limit for maximum streams or incoming messages was exceeded for the websocket connection;
  • There’s a connection interruption with the used proxy/firewall from user side;
  • The requested service address is incorrect;

The handling varies due to different scenarios.
If using websocket, make sure the connection is stabilised and maintained by doing the necessary handshakes (sending pong frames) and check if the maximum streams per connection, as well as the maximum incoming messages are being respected. These limits can be different between Spot and Futures, please consult the API documentation for the detailed description.

If it’s related to unstable network in the middle of data transmission, you can try to rebuild the TCP session or ignore and retry. The user should be prepared for eventual failures on the Application Layer.

1 Like

Heyy, I make a python code and I have this error. The script show me the price once at hour (the first lap return the price perfect but the next hour the problem happend). I try to put try and except in the while loop to fix it but nothing. How can I refresh the session before to get the price ? Could be this: client = Client(credentials.api_key,credentials.secret_key) ? If this fix it obvisly.