'Invoked by a timer to send a heartbeat when we need to, check to see
if we\'ve missed any heartbeats and disconnect our connection if it\'s
been idle too long.'

def send_and_check(self):

    LOGGER.debug('Received    %i    heartbeat    frames,    sent    %i', self._heartbeat_frames_received, self._heartbeat_frames_sent)
    if self.connection_is_idle:
        return self._close_connection()
    if (not self._has_received_data):
        self._idle_byte_intervals += 1
    else:
        self._idle_byte_intervals = 0
    self._update_counters()
    self._send_heartbeat_frame()
    self._start_timer()
