class_docstr: The heartbeat channel which monitors the kernel heartbeat.
  
  Note that the heartbeat channel is paused by default. As long as you start
  this channel, the kernel manager will ensure that it is paused and un-paused
  as appropriate.
class_docstr_tok: ["The","heartbeat","channel","which","monitors","the","kernel","heartbeat",".","Note","that","the","heartbeat","channel","is","paused","by","default",".","As","long","as","you","start","this","channel",",","the","kernel","manager","will","ensure","that","it","is","paused","and","un-paused","as","appropriate","."]
docstr: The thread's main activity.  Call start() instead.
docstr_tok: ["The","thread","'s","main","activity",".","Call","start","(",")","instead","."]
code: def run(self):
      """The thread's main activity.  Call start() instead."""
      self._create_socket()
      self._running = True
      self._beating = True
  
      while self._running:
          if self._pause:
              # just sleep, and skip the rest of the loop
              self._exit.wait(self.time_to_dead)
              continue
  
          since_last_heartbeat = 0.0
          # io.rprint('Ping from HB channel') # dbg
          # no need to catch EFSM here, because the previous event was
          # either a recv or connect, which cannot be followed by EFSM
          self.socket.send(b"ping")
          request_time = time.time()
          ready = self._poll(request_time)
          if ready:
              self._beating = True
              # the poll above guarantees we have something to recv
              self.socket.recv()
              # sleep the remainder of the cycle
              remainder = self.time_to_dead - (
                  time.time() - request_time
              )
              if remainder > 0:
                  self._exit.wait(remainder)
              continue
          else:
              # nothing was received within the time limit, signal heart failure
              self._beating = False
              since_last_heartbeat = time.time() - request_time
              self.call_handlers(since_last_heartbeat)
              # and close/reopen the socket, because the REQ/REP cycle has been broken
              self._create_socket()
              continue
  
imports: from __future__ import absolute_import
  import atexit
  import errno
  from threading import Thread, Event
  import time
  import zmq
  from zmq import ZMQError
  from jupyter_client import protocol_version_info
  from .channelsabc import HBChannelABC
label_desc: Use image node_id 5 for calling the HBChannel obj's underlying member method code with example usage: obj.run() without return types