Send an event to a specific socket Note: 'meta' is typically the name of the channel
545463
function(id, msg, meta) {
        var socket = openSocketsById[id];
        if (socket) {
          return socket.write('0|' + msg + '|' + meta)
        } else {
          return false;
        }
      }
89496
public void sendAuditEvent(AuditEventMessage[] msgs, InetAddress destination, int port) throws Exception 
	{
        if (!EventUtils.isEmptyOrNull(msgs)) {
    		// Check to validate port
    		int portToUse = getTransportPort(port);
        	
        	DatagramSocket socket = new DatagramSocket();

    		for (int i=0; i<msgs.length; i++) {
    			byte[] msgBytes = getTransportPayload(msgs[i]);
    			send(msgBytes, socket, destination, portToUse);
    		}
           socket.close();
        }
	}
874153
function () {
    clearTimeout(timeoutId);
    var args = [];
    for (var index = 0, length = arguments.length; index < length; index++) {
      args.push(arguments[index]);
    }
    self.socketEvent = {
      namespace: action.namespace,
      eventType: action.eventType,
      args: args
    };
    callback(null, self.socketEvent);
  }
1038504
function publishEvent( channelName, eventObj ) {
  var broker = getEventBroker( 'main' )
  eventObj.channel = channelName
  broker.publish( eventObj ); 
}
336414
function ProxySocket(proxy_port, proxy_addr, meta, proxy_opts) {
    stream.Duplex.call(this);

    this.connected_fn = null;
    this.proxy_addr   = proxy_addr;
    this.proxy_port   = proxy_port;
    this.proxy_opts   = proxy_opts || {};

    this.setMeta(meta || {});

    this.state = 'disconnected';
}
1148432
function(event) {
    var meta = _clientMeta[this.id];
    if (!(typeof event === "object" && event && event.type && meta)) {
      return;
    }
    var async = _shouldPerformAsync(event);
    var wildcardTypeHandlers = meta && meta.handlers["*"] || [];
    var specificTypeHandlers = meta && meta.handlers[event.type] || [];
    var handlers = wildcardTypeHandlers.concat(specificTypeHandlers);
    if (handlers && handlers.length) {
      var i, len, func, context, eventCopy, originalContext = this;
      for (i = 0, len = handlers.length; i < len; i++) {
        func = handlers[i];
        context = originalContext;
        if (typeof func === "string" && typeof _window[func] === "function") {
          func = _window[func];
        }
        if (typeof func === "object" && func && typeof func.handleEvent === "function") {
          context = func;
          func = func.handleEvent;
        }
        if (typeof func === "function") {
          eventCopy = _extend({}, event);
          _dispatchCallback(func, context, [ eventCopy ], async);
        }
      }
    }
  }
64760
function HookBackendEvent (adapter, backend, socket) {
          
    function EventDevAuth (device){
        device.websock=0;   // special counter to repost full device every 20 positions
        adapter.Debug (5, "EventDevAuth devid=%s name=%s", device.devid, device.name);
        var msg = 
            {type : 1
               ,devid: device.devid
               ,src  : adapter.src + ' ' + device.adapter.id
               ,model: device.type
               ,name : device.name
               ,call : device.call
               ,cargo: device.cargo
        };
        adapter.BroadcastJson (msg);
    };    
    
    function EventDevTmp (device){
        device.websock=0;   // special counter to repost full device every 20 positions
        adapter.Debug (5, "EventDevTmp devid=%s name=%s", device.devid, device.name);
        var msg = 
        {type : 0
            ,devid: device.devid
            ,src  : adapter.src + ' ' + device.adapter.id
            ,lat  : device.stamp.lat
            ,lon  : device.stamp.lon
            ,sog  : device.stamp.sog
            ,cog  : device.stamp.cog
        };
        adapter.BroadcastJson (msg);
    };    

    // Events successful process by tracker adapter
    function EventDevPos (device){
        adapter.Debug (6, "EventDevPos devid=%s name=%s", device.devid, device.name);
         
         // force push of full device info every 20 positions update
         if (device.websock++ >= 10) EventDevAuth (device); 
         
         var msg = 
            {type : 2
            ,devid: device.devid
            ,src  : adapter.src + ' ' +device.adapter.id
            ,lat  : device.stamp.lat
            ,lon  : device.stamp.lon
            ,sog  : device.stamp.sog
            ,cog  : device.stamp.cog
        };
        adapter.BroadcastJson (msg);
    };
    
    // Events successful process by tracker adapter
    function EventDevPing (device){
        adapter.Debug (7, "EventDevPing devid=%s name=%s", device.devid, device.name);
         
        var msg = 
            {type : 3
            ,devid: device.devid
        };
        adapter.BroadcastJson (msg);
    };
    
     // Events on action refused by tracker adapter
    function EventDevQuit (device){
       var msg=
           {type: 4
           ,devid: device.devid
           };
       adapter.BroadcastJson (msg);
    };

    backend.event.on("dev-tmp" ,EventDevTmp);	
    backend.event.on("dev-auth",EventDevAuth);	
    backend.event.on("dev-pos" ,EventDevPos);	
    backend.event.on("dev-ign" ,EventDevPing);	
    backend.event.on("dev-quit",EventDevQuit);	
}
837307
def _nodedev_event_lifecycle_cb(conn, dev, event, detail, opaque):
    '''
    
    '''
    _salt_send_event(opaque, conn, {
        'nodedev': {
            'name': dev.name()
        },
        'event': _get_libvirt_enum_string('VIR_NODE_DEVICE_EVENT_', event),
        'detail': 'unknown'  # currently unused
    })
945465
def emit(event, data = {}, channel = nil)
      message = { event: event, data: MultiJson.dump(data) }
      message[:channel] = channel if channel

      PusherFake.log("SEND #{id}: #{message}")

      socket.send(MultiJson.dump(message))
    end
1202954
def send(self, message, channel_name=None, fail_silently=False,
             options=None):
        # type: (Text, Optional[str], bool, Optional[SendOptions]) -> None
        
        if channel_name is None:
            channels = self.settings["CHANNELS"]
        else:
            try:
                channels = {
                    "__selected__": self.settings["CHANNELS"][channel_name]
                }
            except KeyError:
                raise Exception("channels does not exist %s", channel_name)

        for _, config in channels.items():
            if "_backend" not in config:
                raise ImproperlyConfigured(
                    "Specify the backend class in the channel configuration")

            backend = self._load_backend(config["_backend"])  # type: Any
            config = deepcopy(config)
            del config["_backend"]
            channel = backend(**config)
            channel.send(message, fail_silently=fail_silently, options=options)
657809
def bind_channel(self, channel, callback):
        """"""

        # Remove the following list when deprecation time expires
        if channel in self.CHANNELS:
            warning = (
                "The event name '{}' will soon be deprecated. Use "
                "the real event name '{}' instead."
            ).format(channel, self.CHANNELS[channel])

            self.handle_error(warning)
            channel = self.CHANNELS[channel]
        # -------------------------------------------------------

        if channel == self.EVENT_NAME_ERROR:
            self.error_callback = callback
        elif channel == self.EVENT_NAME_RESULTS:
            self.socketIO.on(channel, partial(self.unpack_results, callback))
        else:
            self.socketIO.on(channel, callback)
241399
function addListener(event, callback, meta) {
  event.listeners.push(callback);
  event.meta.set(callback, meta);
}
394346
function sendEvent(event) {
  var message = JSON.stringify(event);

  console.log('ws -> send: ' + message);

  var clients = serverMode ? wss.clients : [ws];

  for (var i = 0; i < clients.length; i++) {
    clients[i].send(message);
  }
}
793134
def send_tip(self, sender, receiver, message, context_uid, meta):
        
        assert self.channel is not None, "channel must be defined"

        # Add extra data to meta
        meta["mention_bot"] = self.mention_bot()

        data = json.dumps({
            "channel": self.channel,
            "sender": sender,
            "receiver": receiver,
            "message": message,
            "context_uid": context_uid,
            "meta": meta,
        })
        response = requests.post(self.get_api_url("/tips/"), data=data, headers={'content-type': 'application/json'})
        if response.headers.get("Content-Type", None) == "application/json":
            out = response.json()
            out["state"] = response.reason.lower()
            return out
        else:
            return {"state": response.reason.lower(), "error": "%s error submitting tip" % response.status_code}
45900
def Publish(self, event_name, msg, delay=0):
    """"""
    events_lib.Events.PublishEvent(event_name, msg, delay=delay)
591804
def get_master_event(opts, sock_dir, listen=True, io_loop=None, raise_errors=False, keep_loop=False):
    '''
    
    '''
    # TODO: AIO core is separate from transport
    if opts['transport'] in ('zeromq', 'tcp', 'detect'):
        return MasterEvent(sock_dir, opts, listen=listen, io_loop=io_loop, raise_errors=raise_errors, keep_loop=keep_loop)
990327
function Channel_sendMessage(message) {
  if (!this.wsConn) return
  if (!this.wsConn.connected) return

  DEBUGMSG("send: " + utils.JS(message))

  try {
    this.wsConn.sendUTF(JSON.stringify(message))
  }
  catch(e) {
    // occurs when socket closed, oh well
  }
}