Send a ClientMessage event to the root window
348345
def _setProperty(self, _type, data, win=None, mask=None):
        
        if not win:
            win = self.root
        if type(data) is str:
            dataSize = 8
        else:
            data = (data+[0]*(5-len(data)))[:5]
            dataSize = 32

        ev = protocol.event.ClientMessage(
            window=win,
            client_type=self.display.get_atom(_type), data=(dataSize, data))

        if not mask:
            mask = (X.SubstructureRedirectMask | X.SubstructureNotifyMask)
        self.root.send_event(ev, event_mask=mask)
290540
def send(self, endpoint, json_message):
        
        _send_event_task.spool(endpoint=endpoint, json_message=json_message)
423445
private void send(JainMgcpCommandEvent event) {

		sent = true;

		String host = "";
		int port = 0;

		switch (event.getObjectIdentifier()) {
		case Constants.CMD_NOTIFY:
			Notify notifyCommand = (Notify) event;
			NotifiedEntity notifiedEntity = notifyCommand.getNotifiedEntity();
			if (notifiedEntity == null) {
				notifiedEntity = this.stack.provider.getNotifiedEntity();
			}
			port = notifiedEntity.getPortNumber();
			// if (notifiedEntity.getLocalName() != null) {
			// host = notifiedEntity.getLocalName() + "@";
			// }
			host += notifiedEntity.getDomainName();

			break;
			
        case Constants.CMD_DELETE_CONNECTION:
		case Constants.CMD_RESTART_IN_PROGRESS:
			if(remoteAddress!=null)
			{
				host = remoteAddress.getHostAddress();
				port = remotePort;
				break;
			}
			
		default:
			// determite destination address and port to send request to
			// from endpoint identifier parameter.
			String domainName = event.getEndpointIdentifier().getDomainName();

			// now checks does port number is specified in the domain name
			// if port number is not specified use 2427 by default
			int pos = domainName.indexOf(':');
			if (pos > 0) {
				port = Integer.parseInt(domainName.substring(pos + 1));
				host = domainName.substring(0, pos);
			} else {
				port = 2427;
				host = domainName;
			}
			break;
		}

		// construct the destination as InetAddress object
		InetAddress address = null;
		try {
			address = InetAddress.getByName(host);
		} catch (UnknownHostException e) {
			throw new IllegalArgumentException("Unknown endpoint " + host);
		}

		// save this tx in stack and start timer
		remoteTID = event.getTransactionHandle();
		source = event.getSource();
		event.setTransactionHandle(localTID);

		// encode event object as MGCP command and send over UDP.		
		if(originalPacket==null)
			originalPacket=stack.allocatePacket();
		
		originalPacket.setLength(encode(event,originalPacket.getRawData()));
		InetSocketAddress inetSocketAddress = new InetSocketAddress(address, port);
		originalPacket.setRemoteAddress(inetSocketAddress);		
		
		resetReTransmissionTimer();
		resetTHISTTimerTask(false);

		if (logger.isDebugEnabled())
			logger.debug("Send command event to " + address + "remote TX ID:" + remoteTID + ", message\n" + new String(originalPacket.getRawData(),0,originalPacket.getLength()));
		
		countOfCommandRetransmitted++;
		stack.send(originalPacket);
		
	}
1074513
function TunnelClient(options) {
  var self = this;

  this.__namespace__ = options.namespace || 'tabex_default_';
  this.__handlers__ = [];

  this.__iframe_url__ = options.iframe;
  this.__iframe_done__ = false;

  // Pending emits before iframe ready
  this.__pending__ = [];

  // Create iframe and hide it
  this.__iframe__ = document.createElement('iframe');
  this.__iframe__.style.left = '-1000px';
  this.__iframe__.style.position = 'absolute';

  // When iframe loaded - send all pending messages
  this.__iframe__.onload = function () {

    // Setup target for messages from iframe (we should not use `*` for security reasons)
    self.__iframe__.contentWindow.postMessage(JSON.stringify({
      // `window.location.origin` available from IE 11
      origin: window.location.origin || window.location.protocol + '//' + window.location.host,
      namespace: self.__namespace__
    }), self.__iframe_url__);

    self.__iframe_done__ = true;

    // Send all pending messages
    self.__pending__.forEach(function (data) {
      self.__iframe__.contentWindow.postMessage(JSON.stringify(data), self.__iframe_url__);
    });

    self.__pending__ = null;
  };

  // Listen messages from iframe
  $$.addEvent(window, 'message', function (event) {
    // Check sender origin
    if (self.__iframe_url__.indexOf(event.origin) !== 0) {
      return;
    }

    var data;

    try {
      data = JSON.parse(event.data);
    } catch (__) {
      return;
    }

    // Ignore messages from another namespace (and messages from other possible senders)
    if (data.namespace !== self.__namespace__) {
      return;
    }

    self.__handlers__.forEach(function (handler) {
      handler(data.channel, data.message);
    });
  });

  this.__iframe__.src = this.__iframe_url__;

  var appendIframe = function () {
    document.body.appendChild(self.__iframe__);
  };
  if (document.readyState === 'loading') {
    $$.addEvent(document, 'DOMContentLoaded', appendIframe);
  } else {
    appendIframe();
  }
}
1268736
async def root_message(self, msg, msg_type=None):
        
        await self.root()
        await self.message(msg, msg_type)
1261004
function receiveIframeMessage(event) {
    const data = uiFns.receiveIframeMessageBoilerplate(event);

    if (!data) {
      return;
    }

    switch (data.event) {
      case 'patternlab.updatePath':
        window.location.replace('../../' + data.path);

        break;
    }
  }
614261
function onMessage(data) {
    if (data.type == "utf8") {
        message = JSON.parse(data.utf8Data);
        switch (message.command) {
            case "setJoints":
                console.log("Client has request to add joints: " + message.data);
                nuimotion.jointsTracking = message.data;
                break;

            case "addListener":
                console.log("Client has request to add events: " + message.data);
                if (!nuimotion._eventCallbackDict[message.data]) {
                    nuimotion.addListener(message.data, onEvent);
                }
                break;

            case "addGesture":
                console.log("Client has request to add gestures: " + message.data);
                if (!nuimotion._gestureCallbackDict[message.data]) {
                    nuimotion.addGesture(message.data, onEvent);
                }
                break;
        }
    }
}
1088516
@SuppressWarnings("deprecation")
    @Override
    public void eventCallback(String eventName, Object eventData) {
        try {
            PopupData popupData = null;
            
            if (eventData instanceof PopupData) {
                popupData = (PopupData) eventData;
            } else {
                popupData = new PopupData(eventData.toString());
            }
            
            if (popupData.isEmpty()) {
                return;
            }
            
            Page currentPage = ExecutionContext.getPage();
            Window window = getPopupWindow();
            window.setTitle(popupData.getTitle());
            window.setParent(currentPage);
            String pos = getPosition();
            window.addStyle("left", pos);
            window.addStyle("top", pos);
            window.addEventListener("close", this);
            Label label = window.findByName("messagetext", Label.class);
            label.setLabel(popupData.getMessage());
            window.setMode(Mode.POPUP);
        } catch (Exception e) {}
    }
998413
private void sendInitialMessage(final ChannelHandlerContext ctx) throws Exception {
        final long connectTimeoutMillis = this.connectTimeoutMillis;
        if (connectTimeoutMillis > 0) {
            connectTimeoutFuture = ctx.executor().schedule(new Runnable() {
                @Override
                public void run() {
                    if (!connectPromise.isDone()) {
                        setConnectFailure(new ProxyConnectException(exceptionMessage("timeout")));
                    }
                }
            }, connectTimeoutMillis, TimeUnit.MILLISECONDS);
        }

        final Object initialMessage = newInitialMessage(ctx);
        if (initialMessage != null) {
            sendToProxyServer(initialMessage);
        }

        readIfNeeded(ctx);
    }
389079
function () {
                var msg = [], tp;
                msg.push('## ' + this.$classpath + ' ## ');
                for (var k in this) {
                    if (this.hasOwnProperty(k)) {
                        tp = typeof(this[k]);
                        if (tp == 'object' || tp == 'function')
                            msg.push(k += ':[' + tp + ']');
                        else if (tp == 'string')
                            msg.push(k += ':"' + this[k] + '"');
                        else
                            msg.push(k += ':' + this[k]);
                    }
                }
                Aria.$window.alert(msg.join('\n'));
                msg = null;
            }
9887
public void onModuleLoad() {
    final Button sendButton = new Button( messages.sendButton() );
    final TextBox nameField = new TextBox();
    nameField.setText( messages.nameField() );
    final Label errorLabel = new Label();

    // We can add style names to widgets
    sendButton.addStyleName("sendButton");

    // Add the nameField and sendButton to the RootPanel
    // Use RootPanel.get() to get the entire body element
    RootPanel.get("nameFieldContainer").add(nameField);
    RootPanel.get("sendButtonContainer").add(sendButton);
    RootPanel.get("errorLabelContainer").add(errorLabel);

    // Focus the cursor on the name field when the app loads
    nameField.setFocus(true);
    nameField.selectAll();

    // Create the popup dialog box
    final DialogBox dialogBox = new DialogBox();
    dialogBox.setText("Remote Procedure Call");
    dialogBox.setAnimationEnabled(true);
    final Button closeButton = new Button("Close");
    // We can set the id of a widget by accessing its Element
    closeButton.getElement().setId("closeButton");
    final Label textToServerLabel = new Label();
    final HTML serverResponseLabel = new HTML();
    VerticalPanel dialogVPanel = new VerticalPanel();
    dialogVPanel.addStyleName("dialogVPanel");
    dialogVPanel.add(new HTML("<b>Sending name to the server:</b>"));
    dialogVPanel.add(textToServerLabel);
    dialogVPanel.add(new HTML("<br><b>Server replies:</b>"));
    dialogVPanel.add(serverResponseLabel);
    dialogVPanel.setHorizontalAlignment(VerticalPanel.ALIGN_RIGHT);
    dialogVPanel.add(closeButton);
    dialogBox.setWidget(dialogVPanel);

    // Add a handler to close the DialogBox
    closeButton.addClickHandler(new ClickHandler() {
      public void onClick(ClickEvent event) {
        dialogBox.hide();
        sendButton.setEnabled(true);
        sendButton.setFocus(true);
      }
    });

    // Create a handler for the sendButton and nameField
    class MyHandler implements ClickHandler, KeyUpHandler {
      /**
       * Fired when the user clicks on the sendButton.
       */
      public void onClick(ClickEvent event) {
        sendNameToServer();
      }

      /**
       * Fired when the user types in the nameField.
       */
      public void onKeyUp(KeyUpEvent event) {
        if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER) {
          sendNameToServer();
        }
      }

      /**
       * Send the name from the nameField to the server and wait for a response.
       */
      private void sendNameToServer() {
        // First, we validate the input.
        errorLabel.setText("");
        String textToServer = nameField.getText();
        if (!FieldVerifier.isValidName(textToServer)) {
          errorLabel.setText("Please enter at least four characters");
          return;
        }

        // Then, we send the input to the server.
        sendButton.setEnabled(false);
        textToServerLabel.setText(textToServer);
        serverResponseLabel.setText("");
        greetingService.greetServer(textToServer, new AsyncCallback<String>() {
          public void onFailure(Throwable caught) {
            // Show the RPC error message to the user
            dialogBox.setText("Remote Procedure Call - Failure");
            serverResponseLabel.addStyleName("serverResponseLabelError");
            serverResponseLabel.setHTML(SERVER_ERROR);
            dialogBox.center();
            closeButton.setFocus(true);
          }

          public void onSuccess(String result) {
            dialogBox.setText("Remote Procedure Call");
            serverResponseLabel.removeStyleName("serverResponseLabelError");
            serverResponseLabel.setHTML(result);
            dialogBox.center();
            closeButton.setFocus(true);
          }
        });
      }
    }

    // Add a handler to send the name to the server
    MyHandler handler = new MyHandler();
    sendButton.addClickHandler(handler);
    nameField.addKeyUpHandler(handler);
  }
958713
function _onInboxMessage (sender, _, msgBuffer) {
    let message = JSON.parse(msgBuffer)
    masterBroker.setIP(message.toAddress)

    switch (message.type) {
      case 'voteRequest':
        debug(`sending vote to ${node.name === message.from ? 'myself' : message.from}`)
        _inbox.send([sender, _, JSON.stringify({
          id: _advertiseId || node.id,
          name: node.name,
          endpoints: masterBroker.endpoints,
          isMaster: masterBroker.isMaster,
          candidate: !_advertiseId
        })])
        break
      case 'masterRequest':
        let connectedMaster = node.master
        if (connectedMaster) {
          debug(`sending master coordinates to ${message.from}`)
          _inbox.send([sender, _, JSON.stringify(connectedMaster)])
        } else {
          debug(`unable to send master coordinates to ${message.from}`)
          _inbox.send([sender, _, JSON.stringify(false)])
        }
        break
      case 'masterElected':
        _inbox.send([sender, _, ''])
        debug(`received notice of master election: ${message.data.name}`)
        resolver.emit('newmaster', message.data)
    }
  }
93349
function ContentDialog_fireEvent(eventName, options) {
                    options = options || {};
                    var detail = options.detail || null;
                    var cancelable = !!options.cancelable;

                    var eventObject = _Global.document.createEvent("CustomEvent");
                    eventObject.initCustomEvent(eventName, true, cancelable, detail);
                    return this._dom.root.dispatchEvent(eventObject);
                }
719714
function sendReadyMessage() {
        var data = {
            namespace: MESSAGE_NAMESPACE,
            id: 'iframe-ready'
        };

        parent.postMessage(JSON.stringify(data), '*');
    }
910553
function sendMessage (client, data, batchCallback) {
  var msg = data.msg;
  var offset = data.offset;
  var length = data.length;
  var port = data.port;
  var address = data.address;
  var callback = data.callback;

  client.send(msg, offset, length, port, address, function(err) {
    try {
      callback(err);
    } finally {
      batchCallback();
    }
  });
}
201183
private void runMessage(MessageAmp msg)
  {
    try (OutboxAmp outbox = OutboxAmpFactory.newFactory().get()) {
      outbox.inbox(msg.inboxTarget());
      outbox.message(msg);
      
      //RampActor systemActor = null;
      StubAmp systemActor = _stub;
      
      msg.invoke(InboxExecutorBase.this, systemActor);
      
      while (! outbox.flushAndExecuteLast()) {
      }
    }
  }
28276
def send_event_to_salt(self, result):
        '''
        

        '''
        if result['send']:
            data = result['data']
            topic = result['topic']
            # If the engine is run on master, get the event bus and send the
            # parsed event.
            if __opts__['__role'] == 'master':
                event.get_master_event(__opts__,
                                       __opts__['sock_dir']
                                       ).fire_event(data, topic)
            # If the engine is run on minion, use the fire_master execution
            # module to send event on the master bus.
            else:
                __salt__['event.fire_master'](data=data, tag=topic)