connectordb/_websocket.py
def __ensure_ping(self):
        """Each time the server sends a ping message, we record the timestamp. If we haven't received a ping
        within the given interval, then we assume that the connection was lost, close the websocket and
        attempt to reconnect"""

        logging.debug("ConnectorDB:WS: pingcheck")
        if (time.time() - self.lastpingtime > self.connection_ping_timeout):
            logging.warn("ConnectorDB:WS: Websocket ping timed out!")
            if self.ws is not None:
                self.ws.close()
                self.__on_close(self.ws)
        else:
            # reset the ping timer
            self.pingtimer = threading.Timer(self.connection_ping_timeout,
                                             self.__ensure_ping)
            self.pingtimer.daemon = True
            self.pingtimer.start()
def __ensure_ping(self):
        logging.debug("ConnectorDB:WS: pingcheck")
        if (time.time() - self.lastpingtime > self.connection_ping_timeout):
            logging.warn("ConnectorDB:WS: Websocket ping timed out!")
            if self.ws is not None:
                self.ws.close()
                self.__on_close(self.ws)
        else:
            # reset the ping timer
            self.pingtimer = threading.Timer(self.connection_ping_timeout,
                                             self.__ensure_ping)
            self.pingtimer.daemon = True
            self.pingtimer.start()
def __ensure_ping ( self ) : logging . debug ( "ConnectorDB:WS: pingcheck" ) if ( time . time ( ) - self . lastpingtime > self . connection_ping_timeout ) : logging . warn ( "ConnectorDB:WS: Websocket ping timed out!" ) if self . ws is not None : self . ws . close ( ) self . __on_close ( self . ws ) else : # reset the ping timer self . pingtimer = threading . Timer ( self . connection_ping_timeout , self . __ensure_ping ) self . pingtimer . daemon = True self . pingtimer . start ( )
Each time the server sends a ping message, we record the timestamp. If we haven't received a ping
        within the given interval, then we assume that the connection was lost, close the websocket and
        attempt to reconnect
Each time the server sends a ping message we record the timestamp . If we haven t received a ping within the given interval then we assume that the connection was lost close the websocket and attempt to reconnect