Callback function when receiving message from whatsapp server
494608
def on_message(self, message_protocol_entity):
        
        logger.info("Message id %s received" % message_protocol_entity.getId())
        # answer with receipt
        self.toLower(message_protocol_entity.ack())
89594
function SmsBatch (smsc, callback, smsarray) {
    var idx=0;

    // when message is processed move to next one otherwise call user applicationCB
    function InternalCB (data) {

        // [good or bad] let's notify user application
        if (data.status != 0) callback (data);

        // it's time to move to next message
        if (data.status <= 0) {
            if (++idx < smsarray.length) {
                new SmsRequest (smsc, InternalCB, smsarray [idx]);
            } else {
                callback ({status: 0});
            }
        }
    }

    // let's start by sending 1st SMS of the array
    new SmsRequest(smsc, InternalCB, smsarray [idx]);
}
1144908
def _message_callback(self, msg):
        """"""
        if msg.type == 'polytouch':
            button = button_from_press(msg.note)
            if button:
                self.on_button(button, msg.value != 0)
            elif msg.note == 127:
                self.on_fader_touch(msg.value != 0)
        elif msg.type == 'control_change' and msg.control == 0:
            self._msb = msg.value
        elif msg.type == 'control_change' and msg.control == 32:
            self._fader = (self._msb << 7 | msg.value) >> 4
            self.on_fader(self._fader)
        elif msg.type == 'pitchwheel':
            self.on_rotary(1 if msg.pitch < 0 else -1)
        else:
            print('Unhandled:', msg)
636778
function(callback){
      console.log( 'Start sending messages... ');
      setInterval(function(){
	var msg = '';
	if( program.message != null ){
	  msg = program.message;
	}else{
          msgCounter++;
          msg = 'Hello #' + msgCounter + ' from node.js';
        }
	console.log( '[ubeacon] Sending "' +msg+ '" to device: ' + program.destinationAddress );
        ubeacon.sendMeshGenericMessage( program.destinationAddress, msg, function( response ){
          console.log( '[ubeacon] Mesh message #' + msgCounter + ' sent. Response: ' + response );
        });
      }, interval);
    }
482817
function(passes, message) {
    this.passes = (passes === undefined || passes === true);
    this._customMessage = message;
    this.callback(this.passes, message);
  }
569128
def receive(self, msg):
        '''
        
        '''
        handler = getattr(self, 'receive_' + msg.__class__.__name__.lower(), None)
        if handler is None:
            raise InvalidMessageError('Receiving class does not support messages of type: ' + msg.__class__.__name__)
        return handler(msg)
844315
def a_message_callback(ctx):
    """"""
    message = ctx.ctrl.after.strip().splitlines()[-1]
    ctx.device.chain.connection.emit_message(message, log_level=logging.INFO)
    return True
1101982
def info_msg_callback(self, callback):
        """"""
        if callable(callback):
            self._info_msg_callback = callback
        else:
            self._info_msg_callback = None
1254812
def messenger_received_message(message_string)
      #puts "receive|#{message_string}"
      begin
        message = Messages.from_json(message_string)
      rescue ProtocolError
        @scheduler.receive(:invalid_message)
        return
      end
      case message
      when Messages::CallRequest then @scheduler.receive(:call_request_message, message)
      when Messages::CallResponse then @scheduler.receive(:call_response_message, message)
      when Messages::Compatibility then @scheduler.receive(:compatibility_message, message)
      when Messages::Forget then @scheduler.receive(:forget_message, message)
      when Messages::Initialization then @scheduler.receive(:initialization_message, message)
      when Messages::Shutdown then @scheduler.receive(:shutdown_message)
      end    
    end
615811
def __callback(self, data):
        
        method = self.__cb_message
        if method is not None:
            try:
                method(data)
            except Exception as ex:
                _logger.exception("Error calling method: %s", ex)
1004272
function onMessageCallback(data) {
        // "cancel" button is clicked
        if (data == 'PermissionDeniedError') {
            chromeMediaSource = 'PermissionDeniedError';
            if (screenCallback) {
                return screenCallback('PermissionDeniedError');
            } else {
                throw new Error('PermissionDeniedError: User rejected to share his screen.');
            }
        }

        // extension notified his presence
        if (data == 'rtcmulticonnection-extension-loaded') {
            chromeMediaSource = 'desktop';
        }

        // extension shared temp sourceId
        if (data.sourceId && screenCallback) {
            sourceId = data.sourceId;
            screenCallback(sourceId);
        }
    }
486643
def receive_message(self, message, data):
        
        if data['type'] == TYPE_RESPONSE_STATUS:
            self.is_launched = True
        return True
2110
def on_message(msg, server):
    """"""
    text = msg.get("text", "")
    match = re.findall(r"!gif (.*)", text)
    if not match:
        return

    res = gif(match[0])
    if not res:
        return

    attachment = {
        "fallback": match[0],
        "title": match[0],
        "title_link": res,
        "image_url": res
    }
    server.slack.post_message(
        msg['channel'],
        '',
        as_user=server.slack.username,
        attachments=json.dumps([attachment]))
638698
function(msg, callback) {
    try {
      var result = JSON.parse(msg.content);

      // the message is ack'ed on success
      // second parameter is optional for logging
      callback(null, result);
    } catch(err) {

      // the message is nack'ed on error
      callback(err);
    }
  }
564531
def _onMessage(self, ws, message):
        
        try:
            data = json.loads(message)['NotificationContainer']
            log.debug('Alert: %s %s %s', *data)
            if self._callback:
                self._callback(data)
        except Exception as err:  # pragma: no cover
            log.error('AlertListener Msg Error: %s', err)
49405
def notify(callback_method, *data)
    # TODO throw error here ?
    return unless node.persistent?

    msg = Messages::Notification.new :method  => callback_method,
                                     :args    => data,
                                     :headers => @node.message_headers

    # TODO surround w/ begin/rescue block,
    # raise RJR::ConnectionError on socket errors
    @node.send_msg msg.to_s, @connection
  end
408026
def callback(self, herald_svc, message):
        
        if self.__callback is not None:
            try:
                # pylint: disable=W0703
                self.__callback(herald_svc, message)
            except Exception as ex:
                _logger.exception("Error calling callback: %s", ex)