Python Webbsocket error Errorno 104

Hi,

I’m receiving an error Errno 104 connection reset by peer when streaming data using websockets. After some search it seems that this error is produced on the server side. I am using a dispatcher as recommended in the websocket library, here is a snippet:

websocket.enableTrace(True)
ws = websocket.WebSocketApp(endpoint, on_open=on_open, on_message=on_message, on_close = on_close, on_error = on_error)
ws.run_forever(dispatcher = rel, reconnect = 3)
rel.signal(2, rel.abort)
rel.dispatch()

This is the enpoing being used: endpoint = “wss://stream.data.alpaca.markets/v2/sip”

This problem occurs intermittently, could happen every few mins or every number of hours.

Any possible solution would be appreciate it.
Thanks,
Ricardo

1 Like