code: def on_msg(self, callback, remove=False):
          
          self._msg_callbacks.register_callback(callback, remove=remove)
docs: (Un)Register a custom msg receive callback.
  
          Parameters
          ----------
          callback: callable
              callback will be passed three arguments when a message arrives::
  
                  callback(widget, content, buffers)
  
          remove: bool
              True if the callback should be unregistered.