code: def publish_event(self, data, suffix=''):
          
          try:
              event_type = data.pop('event_type')
          except KeyError:
              return {'result': 'error', 'message': 'Missing event_type in JSON data'}
  
          return self.publish_event_from_dict(event_type, data)
docs: AJAX handler to allow client-side code to publish a server-side event