Hi everybody,
following the websocket examples provided here I managed to get a small python script working: it receives miniticker data as expected.
However, when I use ws_client.stop() as in the example, I get:
WebSocket connection closed: connection was closed uncleanly (peer dropped the TCP connection without previous WebSocket closing handshake) , code: 1006, clean: False, reason: connection was closed uncleanly (peer dropped the TCP connection without previous WebSocket closing handshake)
Here is the relevant code:
if __name__ == '__main__':
sdf = SimplestDataFetcher()
sdf.init_connection()
while True:
try:
time.sleep(0.1)
except KeyboardInterrupt:
sdf.close_connection()
time.sleep(5)
sys.exit(0)
in the SimplestDataFetcher class:
def close_connection(self):
self._client.stop()
self._logger.info("Execution interrupted by the user via ctrl-c")
What am I doing wrong?