Broadcast a message to all components in this scope that have registered
a listener for the named message type
@param  {string} messageName The message name
@param  {any} data The message data
@returns {void}
@private
559657
function broadcast(messageName, data) {
            var i, len, instance, messages;
            for (i = 0, len = instances.length; i < len; ++i) {
                instance = instances[i];
                if (!instance) {
                    continue;
                }
                messages = instance.messages || [];

                if (util.inArray(messageName, messages) !== -1) {
                    if (util.isFn(instance.onmessage)) {
                        instance.onmessage.call(instance, messageName, data);
                    }
                }
            }
        }
560766
private void callOnTextMessage(byte[] data)
    {
        if (mWebSocket.isDirectTextMessage())
        {
            mWebSocket.getListenerManager().callOnTextMessage(data);
            return;
        }

        try
        {
            // Interpret the byte array as a string.
            // OutOfMemoryError may happen when the size of data is too big.
            String message = Misc.toStringUTF8(data);

            // Call onTextMessage() method of the listeners.
            callOnTextMessage(message);
        }
        catch (Throwable t)
        {
            // Failed to convert payload data into a string.
            WebSocketException wse = new WebSocketException(
                WebSocketError.TEXT_MESSAGE_CONSTRUCTION_ERROR,
                "Failed to convert payload data into a string: " + t.getMessage(), t);

            // Notify the listeners that text message construction failed.
            callOnError(wse);
            callOnTextMessageError(wse, data);
        }
    }
288692
public void onMessage(WSMessage message) {
        log.trace("Listeners: {}", listeners.size());
        for (IWebSocketDataListener listener : listeners) {
            try {
                listener.onWSMessage(message);
            } catch (Exception e) {
                log.warn("onMessage exception", e);
            }
        }
    }
299849
function startListeningForEvent(eventName, namespace) {
    document.documentElement.addEventListener(eventNameMapping[eventName] || eventName, handleEvent.bind(null, namespace, "data-" + namespace + "-name", getEventRegistry(namespace)[eventName]));
}
1280633
function broadcastReply(command, payload) {
    self.clients.matchAll()
        .then(clients => {
            for (const client of clients) {
                client. /*OK*/ postMessage({
                    command,
                    payload,
                });
            }
        });
}
1358604
function( data ){

            var self = this
                ,candidates
                ;

            candidates = self.broadPhase();

            if ( candidates.length ){

                this._world.emit( this.options.channel, {
                    candidates: candidates
                });
            }
        }
1364178
@SuppressWarnings("unchecked")
    private void dispatchMessage(ArrayListMultimap<Integer, MessageListener> listenerMap, Message message) {
        List<MessageListener> messageListeners;

        // If the message is a Channel Message, hit the channel based listeners first.
        if (message instanceof ChannelMessage) {
            messageListeners = listenerMap.get(((ChannelMessage) message).getChannelInt());
            if (messageListeners != null) {
                for (MessageListener listener : messageListeners) {
                    listener.messageReceived(message);
                }
            }
        }

        // Then send the message to any listeners registered to all channels
        //   or to listeners for messages that do not support channels.
        messageListeners = listenerMap.get(null);
        if (messageListeners != null) {
            for (MessageListener listener : messageListeners) {
                listener.messageReceived(message);
            }
        }
    }
345918
function(event_name, event_args) {

		if (Lava.schema.DEBUG && typeof(event_name) == "undefined") Lava.t();

		if (this._listeners[event_name] != null) {

			this._callListeners(this._listeners[event_name], event_args);

		}

	}
670177
public void init(BaseMessageHeader messageHeader, Object data)
    {
        m_messageDataDesc = null;
        m_externalMessage = null;
        
        m_messageHeader = messageHeader;
        this.setData(data);
        m_bIsConsumed = false;
    }
724908
function PostEmitter() {
	var _this = this;
	//might be global
	this._listener = function(ev) {
		//check origin
		//then
		var data = ev.data;
		_this.emit.apply(_this, data instanceof Array ? data : [data]);
	};
	window[attach](prefix + 'message', this._listener);
}
51286
function (data) {
    if (this.silent) {
      return;
    }
    data = this.prefix ? this.prefix + '.' + data : data;
    var buffer = new Buffer(data);
    this.client.send(buffer, 0, buffer.length, this.port, this.host);
  }
853808
function message(msg, rinfo) {
    self._open = true;
    msg = self._readEncoding ?
      msg.toString(self._readEncoding) :
      msg;

    self.emit('data', msg, {
      port: rinfo.port,
      host: rinfo.address
    },
    rinfo.family.toLowerCase());
  }
1115706
@Benchmark
  @BenchmarkMode(Mode.SampleTime)
  @OutputTimeUnit(TimeUnit.NANOSECONDS)
  public Span addMessageEvent(Data data) {
    data.span.addMessageEvent(
        io.opencensus.trace.MessageEvent.builder(Type.RECEIVED, 1)
            .setUncompressedMessageSize(3)
            .build());
    return data.span;
  }
13700
function EventAisData (aismsg, aisnmea){
        adapter.Debug (9, "devid=%s aistype=%d nmea=%s", aismsg.mmsi, aismsg.aistype, aisnmea);
        adapter.BroadcastAisData (aismsg, aisnmea);
    }
728620
function Messages () {
  var self = this;

  if (!(this instanceof Messages)) return new Messages();

  events.EventEmitter.call(this);

  debug('new messages');

  /**
   * When a socket is accepted
   *
   * @param {object} socket
   */

  this.onConnection = function (socket) {

    debug('on connection %s', socket.id);

    /**
     * This is used to add listeners to sockets when the Messages.prototype.action()
     * method is invoked
     *
     * @param {string} name
     */

    function onAction (name) {
      debug('on action %s', name);
      if (socket.listeners(name).indexOf(self.onMessage) < 0) {
        socket.on(name, function () {
          debug('socket on %s', name);
          var args = Array.prototype.slice.call(arguments);
          self.onMessage(socket, [name].concat(args));
        });
      }
    }
   
    self.on('action', onAction);

    /*
     * take the current actions and set up handlers for them
     */

    if (self.actions()) {
      self.actions().forEach(onAction);
    }


    /*
     * when we disconnect we want to remove the handlers and the onAction
     * method
     */

    socket.on('disconnect', function () {
      debug('on disconnect %s', socket.id);
      self.removeListener('action', onAction);
      self.actions().forEach(function (name) {
        debug('removing listeners for %s', name);
        socket.removeAllListeners(name);
        debug('listener count %s for %s', socket.listeners(name).length, name);
      });
    });

  };

  /*
   * Called when we receive data from the socket
   * It will build up the actor, target, and content
   * to produce a json object that will be published
   * onto an publisher / event emitter
   */

  this.onMessage = function (socket, args) {
    debug('on message %s', socket.id);
    args = args || [];
    if (!args.length) return;
    var message, isMessage = false;
    if (args.length === 2 && args[1] && args[1].isMessage) {
      isMessage = true;
      message = Message(args[1]);  
    }
    else {
      message = Message();
    }
    message.action(args.shift());
    self.actor(socket, function (err, actor) {
      debug('on actor %s, %s', socket.id, actor);
      if (err) {
        return self.emit('error', err, socket, args);
      }
      message.actor(actor);
      self.target(socket, args, function (err, target) {
        debug('on target %s, %s', socket.id, actor);
        if (err) {
          return self.emit('error', err, socket, args);
        }
        message.target(target);
        if (!isMessage) message.content(args);
        self.emit('message', message, socket);
      });
    });
  };

  /*
   * the middleware fucntion we attach to socket.io. It looks for events and if
   * we have auto propagation turned on it will trigger events that are *not*
   * in the current action set.
   */

  this.middleware = function (socket, next) {
    debug('middleware invoked on socket %s', socket.id);
    socket.onevent = self.onSocketEvent;
    next();
  };

  /*
   * The function we override the onevent with.
   */

  // TODO lets use socket.io-events

  this.onSocketEvent = function(packet) {
    debug('on socket event for socket %s', this.id);
    var args = packet.data || [];

    if (null != packet.id) {
      args.push(this.ack(packet.id));
    }

    if (this.listeners(args[0]).length) {
      events.EventEmitter.prototype.emit.apply(this, args);
    }
    else if (self.autoPropagate()) {
      self.onMessage(this, args);
    }

  };

  this.setMaxListeners(0);
}
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;
        }
    }
}
77939
function(e, data) {
		mfp.ev.triggerHandler(NS + e, data);

		if(mfp.st.callbacks) {
			// converts "mfpEventName" to "eventName" callback and triggers it if it's present
			e = e.charAt(0).toLowerCase() + e.slice(1);
			if(mfp.st.callbacks[e]) {
				mfp.st.callbacks[e].apply(mfp, $.isArray(data) ? data : [data]);
			}
		}
	}