code: def close(self, *args, **kwargs):
          
          self.run_event.set()
          self.ws.close()
  
          if self.keepalive and self.keepalive.is_alive():
              self.keepalive.join()
docs: Closes the websocket connection and waits for the ping thread to close