def stop(self):
        """Stops the pusherclient cleanly
        """
        self.pusherthread_stop.set()
        self.pusher.disconnect()

        # wait until pusher is down
        while self.pusher.connection.state is "connected":
            sleep(0.1)
        logging.info("shutting down pusher connector thread")