After some time of running the WebSocket the error [Errno 54] Connection reset by a peer occurs. This happens after some random amount of time, sometimes within a day, sometimes after a couple of days. I tried to fix this by changing the on_error function to:
def on_error(self, e, data=None):
print('{} - data: {}'.format(e, data))
self.error = e
self.stop = True
self.thread.join()
self.start()
to have it close the connection after an error occurs and restart the connection. This however gives me another error, RuntimeError: cannot join current thread.
Is there a way to solve this problem?
After some time of running the WebSocket the error [Errno 54] Connection reset by a peer occurs. This happens after some random amount of time, sometimes within a day, sometimes after a couple of days. I tried to fix this by changing the on_error function to: def on_error(self, e, data=None): print('{} - data: {}'.format(e, data)) self.error = e self.stop = True self.thread.join() self.start() to have it close the connection after an error occurs and restart the connection. This however gives me another error, RuntimeError: cannot join current thread. Is there a way to solve this problem?