btfxwss/connection.py
def _on_message(self, ws, message):
        """Handles and passes received data to the appropriate handlers.

        :return:
        """
        self._stop_timers()

        raw, received_at = message, time.time()
        self.log.debug("_on_message(): Received new message %s at %s",
                       raw, received_at)
        try:
            data = json.loads(raw)
        except json.JSONDecodeError:
            # Something wrong with this data, log and discard
            return

        # Handle data
        if isinstance(data, dict):
            # This is a system message
            self._system_handler(data, received_at)
        else:
            # This is a list of data
            if data[1] == 'hb':
                self._heartbeat_handler()
            else:
                self._data_handler(data, received_at)

        # We've received data, reset timers
        self._start_timers()
def _on_message(self, ws, message):
        self._stop_timers()

        raw, received_at = message, time.time()
        self.log.debug("_on_message(): Received new message %s at %s",
                       raw, received_at)
        try:
            data = json.loads(raw)
        except json.JSONDecodeError:
            # Something wrong with this data, log and discard
            return

        # Handle data
        if isinstance(data, dict):
            # This is a system message
            self._system_handler(data, received_at)
        else:
            # This is a list of data
            if data[1] == 'hb':
                self._heartbeat_handler()
            else:
                self._data_handler(data, received_at)

        # We've received data, reset timers
        self._start_timers()
def _on_message ( self , ws , message ) : self . _stop_timers ( ) raw , received_at = message , time . time ( ) self . log . debug ( "_on_message(): Received new message %s at %s" , raw , received_at ) try : data = json . loads ( raw ) except json . JSONDecodeError : # Something wrong with this data, log and discard return # Handle data if isinstance ( data , dict ) : # This is a system message self . _system_handler ( data , received_at ) else : # This is a list of data if data [ 1 ] == 'hb' : self . _heartbeat_handler ( ) else : self . _data_handler ( data , received_at ) # We've received data, reset timers self . _start_timers ( )
Handles and passes received data to the appropriate handlers.

        :return:
Handles and passes received data to the appropriate handlers .