def _read_websocket_message(cls, message): """Read incoming websocket messages.""" if message is None: FAILED_WEBSOCK.inc() LOGGER.warning("Connection to %s closed: %s (%s)", cls.websocket_url, cls.websocket.close_reason, cls.websocket.close_code) cls.websocket = None
def _websocket_connect_status(cls, future): """Check if connection attempt succeeded.""" try: result = future.result() except: # pylint: disable=bare-except result = None cls.websocket = result if result is None: # TODO: print the traceback as debug message when we use logging module instead of prints here FAILED_WEBSOCK.inc() LOGGER.warning("Unable to connect to: %s", cls.websocket_url) else: LOGGER.info("Connected to: %s", cls.websocket_url) result.write_message("subscribe-reposcan") cls.report_version()