code: def notify(self, frame_type, headers=None, body=None):
          
          if frame_type == 'receipt':
              # logic for wait-on-receipt notification
              receipt = headers['receipt-id']
              receipt_value = self.__receipts.get(receipt)
              with self.__send_wait_condition:
                  self.set_receipt(receipt, None)
                  self.__send_wait_condition.notify()
  
              if receipt_value == CMD_DISCONNECT:
                  self.set_connected(False)
                  # received a stomp 1.1+ disconnect receipt
                  if receipt == self.__disconnect_receipt:
                      self.disconnect_socket()
                  self.__disconnect_receipt = None
  
          elif frame_type == 'connected':
              self.set_connected(True)
  
          elif frame_type == 'disconnected':
              self.set_connected(False)
  
          with self.__listeners_change_condition:
              listeners = sorted(self.listeners.items())
  
          for (_, listener) in listeners:
              if not listener:
                  continue
  
              notify_func = getattr(listener, 'on_%s' % frame_type, None)
              if not notify_func:
                  log.debug("listener %s has no method on_%s", listener, frame_type)
                  continue
              if frame_type in ('heartbeat', 'disconnected'):
                  notify_func()
                  continue
              if frame_type == 'connecting':
                  notify_func(self.current_host_and_port)
                  continue
  
              if frame_type == 'error' and not self.connected:
                  with self.__connect_wait_condition:
                      self.connection_error = True
                      self.__connect_wait_condition.notify()
  
              rtn = notify_func(headers, body)
              if rtn:
                  (headers, body) = rtn
          return (headers, body)
docs: Utility function for notifying listeners of incoming and outgoing messages
  
          :param str frame_type: the type of message
          :param dict headers: the map of headers associated with the message
          :param body: the content of the message