class_docstr: Manages the Comm connection between IPython and the browser (client).
  
  Comms are 2 way, with the CommSocket being able to publish a message
  via the send_json method, and handle a message with on_message. On the
  JS side figure.send_message and figure.ws.onmessage do the sending and
  receiving respectively.
code: def on_message(self, message):
      # The 'supports_binary' message is relevant to the
      # websocket itself.  The other messages get passed along
      # to matplotlib as-is.
  
      # Every message has a "type" and a "figure_id".
      message = json.loads(message["content"]["data"])
      if message["type"] == "closing":
          self.on_close()
          self.manager.clearup_closed()
      elif message["type"] == "supports_binary":
          self.supports_binary = message["value"]
      else:
          self.manager.handle_json(message)
  
imports: import six
  from base64 import b64encode
  import io
  import json
  import os
  import uuid
  from IPython.display import display, Javascript, HTML
  from matplotlib import rcParams, is_interactive
  from matplotlib._pylab_helpers import Gcf
  from matplotlib.backend_bases import _Backend, FigureCanvasBase, NavigationToolbar2
  from matplotlib.backends.backend_webagg_core import FigureCanvasWebAggCore, FigureManagerWebAgg, NavigationToolbar2WebAgg, TimerTornado
label_desc: Use image node_id 6 for calling the CommSocket obj's underlying member method code with example usage: obj.on_message(message) without return types