class_docstr: Base asynchronize message handler.
  
  The tracker and client follows a simple message protocol.
  The message is in form [nbytes(int32)] [json-str].
  All the information is packed in json-str
docstr: Callback when a message is received.
  
  Parameters
  ----------
  message : bytearray
      The bytes received
docstr_tok: ["Callback","when","a","message","is","received",".","Parameters","--","--","--","--","--","message",":","bytearray","The","bytes","received"]
code: def on_message(self, message):
      """Callback when a message is received.
  
      Parameters
      ----------
      message : bytearray
          The bytes received
      """
      assert isinstance(message, bytes)
      if self._init_req_nbytes:
          self._init_conn(message)
          return
  
      self._data += message
  
      while True:
          if self._msg_size == 0:
              if len(self._data) >= 4:
                  self._msg_size = struct.unpack("<i", self._data[:4])[
                      0
                  ]
              else:
                  return
          if (
              self._msg_size != 0
              and len(self._data) >= self._msg_size + 4
          ):
              msg = py_str(bytes(self._data[4 : 4 + self._msg_size]))
              del self._data[: 4 + self._msg_size]
              self._msg_size = 0
              # pylint: disable=broad-except
              self.call_handler(json.loads(msg))
          else:
              return
  
imports: import asyncio
  import heapq
  import logging
  import socket
  import threading
  import errno
  import struct
  import json
  from tvm.contrib.popen_pool import PopenWorker
  from .._ffi.base import py_str
  from .None import base
  from .base import RPC_TRACKER_MAGIC, TrackerCode
label_desc: Use image node_id 5 for calling the TCPEventHandler obj's underlying member method code with example usage: obj.on_message(message) without return types