(self, timestamp)
Records the latency of clients (from the server's perspective) via a
        log message.

        .. note::

            This is the ``pong`` specified in the WebSocket protocol itself.
            The `pong` method is a Gate One-specific implementation.
Records the latency of clients (from the server's perspective) via a
        log message.
Records the latency of clients ( from the server s perspective ) via a log message .
def on_pong(self, timestamp):
        """
        Records the latency of clients (from the server's perspective) via a
        log message.

        .. note::

            This is the ``pong`` specified in the WebSocket protocol itself.
            The `pong` method is a Gate One-specific implementation.
        """
        self.latency_count += 1
        latency = int(time.time() * 1000) - int(timestamp)
        if latency < 0:
            return # Something went wrong; skip this one
        self.timestamps.append(latency)
        if len(self.timestamps) > 10:
            self.timestamps.pop(0)
        self.latency = sum(self.timestamps)/len(self.timestamps)
        if self.latency_count > 12: # Only log once a minute
            self.latency_count = 0
            self.logger.info(_("WebSocket Latency: {0}ms").format(self.latency))
def on_pong ( self , timestamp ) : self . latency_count += 1 latency = int ( time . time ( ) * 1000 ) - int ( timestamp ) if latency < 0 : return # Something went wrong; skip this one self . timestamps . append ( latency ) if len ( self . timestamps ) > 10 : self . timestamps . pop ( 0 ) self . latency = sum ( self . timestamps ) / len ( self . timestamps ) if self . latency_count > 12 : # Only log once a minute self . latency_count = 0 self . logger . info ( _ ( "WebSocket Latency: {0}ms" ) . format ( self . latency ) )