Either send a message (choosing between rtm and postMessage) or ignore the response.

        :param event: a slacker event dict
        :param res: a string, a dict, or None.
          See the command docstring for what these represent.
335322
def _handle_command_response(self, res, event):
        

        response_handler = None

        if isinstance(res, basestring):
            response_handler = functools.partial(self._send_rtm_message, event['channel'])
        elif isinstance(res, dict):
            response_handler = self._send_api_message

        if response_handler is not None:
            response_handler(res)
1105778
def trigger(self, event):
        

        topic = event.data.get('topic', None)
        if topic is None:
            self.log('No alert topic to trigger', lvl=warn)
            return

        alert = {
            'topic': topic,
            'message': event.data.get('msg', 'Alert has been triggered'),
            'role': event.data.get('role', 'all')
        }

        self._trigger(event, alert)
619563
def messageReceived(self, message):
        
        msgId, msg = message[0], message[2:]
        self._releaseId(msgId)
        d, canceller = self._requests.pop(msgId, (None, None))

        if canceller is not None and canceller.active():
            canceller.cancel()

        if d is None:
            # reply came for timed out or cancelled request, drop it silently
            return

        d.callback(msg)
391055
def on_message(self, event):
        '''
        '''

        metadata = self._parse_metadata(event)
        message = Message(text=metadata['text'],
                          metadata=metadata).__dict__
        if message.get('text'):
            message['text'] = self.find_and_replace_userids(message['text'])
            message['text'] = self.find_and_replace_channel_refs(
                message['text']
            )
        return message
1046050
def event_return(events):
    '''
    
    '''
    _options = _get_options()

    api_url = _options.get('api_url')
    channel = _options.get('channel')
    username = _options.get('username')
    hook = _options.get('hook')

    is_ok = True
    for event in events:
        log.debug('Event: %s', event)
        log.debug('Event data: %s', event['data'])
        message = 'tag: {0}\r\n'.format(event['tag'])
        for key, value in six.iteritems(event['data']):
            message += '{0}: {1}\r\n'.format(key, value)
        result = post_message(channel,
                              message,
                              username,
                              api_url,
                              hook)
        if not result:
            is_ok = False

    return is_ok
1000727
async def send_message(  # type: ignore
        self, request: str, response_expected: bool, **kwargs: Any
    ) -> Response:
        
        headers = dict(self.DEFAULT_HEADERS)
        headers.update(kwargs.pop("headers", {}))

        response = await self.client.fetch(
            self.endpoint, method="POST", body=request, headers=headers, **kwargs
        )

        return Response(response.body.decode(), raw=response)
592702
function handle_res (self, res) {
	//debug.log('handle_res()...');

	debug.assert(self).is('object');
	debug.assert(res).is('object');
	debug.assert(res.client).is('object');

	let client = res.client;

	debug.assert(client.query).is('function');

	let conn = {
		"query": nr_nfbind("nor-pg:query", client.query.bind(client)),
		"done": res.done,
		"client": client
	};

	self._conn = conn;

	// Pass NOTIFY to clients
	if (is.func(self.emit)) {
		debug.assert(self._notification_listener).is('function');
		client.on('notification', self._notification_listener);
	}

	return self;
}
286603
def on_message(self, data):
        
        # Trying to parse response
        data = json.loads(data)
        if not data["name"] is None:
            logging.debug("%s: receiving message %s" % (data["name"], data["data"]))
            fct = getattr(self, "on_" + data["name"])
            try:
                res = fct(Struct(data["data"]))
            except:
                # We try without Struct item (on transaction request this can happend)
                res = fct(data["data"])
            if res is not None:
                self.write_message(res)
        else:
            logging.error("SockJSDefaultHandler: data.name was null")
734429
function responseHandler (res, next) {
  return function (err, message) {
    if (err || !message) {
      next(err);
    } else {
      res.send(message);
    }
  }
}
431920
def cancel(self, event):
        

        topic = event.data.get('topic', None)
        if topic is None:
            self.log('No alert topic to cancel', lvl=warn)
            return
        self._cancel(topic)
759244
def onmessage(msg)
      msg = Oj.strict_load(msg)

      msg['data'] = Oj.strict_load(msg['data']) if msg['data'].is_a? String

      event = msg['event'].gsub(/\Apusher:/, 'pusher_')

      if event =~ /\Aclient-/
        msg['socket_id'] = connection.socket_id
        Channel.send_client_message msg
      elsif respond_to? event, true
        send event, msg
      end

    rescue JSON::ParserError
      error({ code: 5001, message: "Invalid JSON" })
    rescue Exception => e
      error({ code: 500, message: "#{e.message}\n #{e.backtrace.join "\n"}" })
    end
259474
function(req, res) {
            var name = req.params.name;
            var time = parseInt(req.params.time);
            if (!time && time !== 0) {
                return res.send(400, "invalid timestamp.");
            }
            var messages = [];
            this.readMessages(name, time, function(message) {
                if (message) {
                    messages.push(message);
                } else {
                    res.send(messages);
                }
            })
        }
1111556
def notify(event)
      fail NoEventError, 'Please pass an event object, not a class' if event.is_a?(Class)

      @handlers[event.class.to_s].each { |handler| handler.call(event) }
    end
461562
function response(event) {
  self.postMessage(event, openpgp.util.getTransferables(event.data, true));
}
309587
public void afterResponse(Event event) {
		ChaincodeMessage message = messageHelper(event);
		try {
			sendChannel(message);
			logger.debug(String.format("[%s]Received %s, communicated (state:%s)",
					shortID(message), message.getType(), fsm.current()));
		} catch (Exception e) {
			logger.error(String.format("[%s]error sending %s (state:%s): %s", shortID(message),
					message.getType(), fsm.current(), e));
		}
	}
615711
def post_event_cancel(self, id, **data):
        
        
        return self.post("/events/{0}/cancel/".format(id), data=data)
501165
private void onMessageSent(MessageSentEvent event) {
        handler.post(() -> listener.onMessageSent(event));
        log("Event published " + event.toString());
    }