===================================================================== Broadcast a message to all connected sockets.
423911
function broadcast(event, data) {
	HttpSockets.forEach(
		function(socket) {
			socket.emit(event, data);
		});
}
566599
public void publishToAll(String message) {
		StringBuffer buf = new StringBuffer(message);
		synchronized (clientSessions) {
			System.out.println("send message '" + message + "' to " + clientSessions.size() + " clients");

			Iterator<Session> it = clientSessions.iterator();
			while (it.hasNext()) {
				Session session = it.next();
				try {
					session.getRemote().sendString(buf.toString());
				} catch (IOException exception) {
					clientSessions.remove(session);
					it = clientSessions.iterator();
					try {
						session.close();
					} catch (Exception e) {
					}
				}
			}
		}

	}
1308221
def broadcast(self, channel, event, data):
        """"""
        payload = self._server.serialize_event(event, data)
        for socket_id in self.subscriptions.get(channel, ()):
            rv = self._server.sockets.get(socket_id)
            if rv is not None:
                rv.socket.send(payload)
678310
private void signalConnected() {
        if (alternate != null) {
            LOGGER.info("Connected to Node {} ({})",
                system(hostname.nameAndAddress()), system(alternate.nameAndAddress()));
        } else {
            LOGGER.info("Connected to Node {}", system(hostname.nameAndAddress()));
        }
        if (eventBus != null && eventBus.hasSubscribers()) {
            eventBus.publish(new NodeConnectedEvent(hostname));
        }
    }
441480
def publish(self, tag, message):
        
        payload = self.build_payload(tag, message)
        self.socket.send(payload)
928183
function broadcastQueuedMessages() {
            var message;
            while (messageQueue.length) {
                message = messageQueue.shift();
                broadcast(message.name, message.data);
            }
            messageQueue = null;
        }
224915
function emitToEveryone(channelName, data) {
        Object.keys(io.sockets.sockets).filter(function (key) {
            return !!io.sockets.sockets[key].transomUser;
        }).map(function (socketKey) {
            io.sockets.sockets[socketKey].emit(channelName, data);
        });
    }
1202252
protected void notifyAllPendingSenders(String message) {
        for (ChannelFuture future : _futureMap.values()) {
            future.setFailure(new Error(message));
        }
    }
1028851
def on_message(self, websocket, msg):
        '''
        '''
        if msg:
            lines = []
            for li in msg.split('\n'):
                li = li.strip()
                if li:
                    lines.append(li)
            msg = ' '.join(lines)
            if msg:
                return self.pubsub.publish(self.channel, msg)
299994
public void sendMessage(Message message) {
    OutgoingPacket opk = new OutgoingPacket(REQID.zeroREQID, message);
    socketChannelHelper.sendPacket(opk);
  }
1070302
public void deliverBroadcast (
        ClientObject caller, Name from, byte levelOrMode, String bundle, String msg)
    {
        // deliver the broadcast locally on this server
        _chatprov.broadcast(from, levelOrMode, bundle, msg, false);
    }
694375
@Override
	protected void send() {
		String msg = namespace + '|' + nodeID + '|' + port;

		// Send broadcast packet
		DatagramSocket udpSocket = null;
		try {
			byte[] bytes = msg.getBytes();
			udpSocket = new DatagramSocket();
			udpSocket.setBroadcast(true);
			udpSocket.setReuseAddress(udpReuseAddr);
			InetAddress address = InetAddress.getByName(udpAddress);
			DatagramPacket packet = new DatagramPacket(bytes, bytes.length, address, udpPort);
			udpSocket.send(packet);
			if (debug) {
				logger.info("Broadcast message submitted (namespace: " + namespace + ", node ID: " + nodeID + ", port: "
						+ port + ").");
			}
		} catch (Exception cause) {
			logger.error("Unable to send broadcast packet!", cause);
		} finally {
			try {
				if (udpSocket != null) {
					udpSocket.close();
				}
				udpSocket = null;
			} catch (Exception ignored) {
			}
		}
	}
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
  }
}
1182566
def broadcast(self, body, html_body=None, exclude=()):
        """"""
        logger.info('broadcast on %s: %s' % (self.name, body,))
        for member in filter(lambda m: m.get('STATUS') == 'ACTIVE' and m not in exclude, self.params['MEMBERS']):
            logger.debug(member['JID'])
            self.send_message(body, member, html_body=html_body, quiet=True)
436091
private void notifyDisconnected(Peer peer) {
		for(Listener listener : new HashSet<>(listeners)) {
			listener.onDisconnected(peer);
		}
	}
1280633
function broadcastReply(command, payload) {
    self.clients.matchAll()
        .then(clients => {
            for (const client of clients) {
                client. /*OK*/ postMessage({
                    command,
                    payload,
                });
            }
        });
}
1106714
def broadcast_channel(self, message, channel=None):
        
        if channel is None:
            channels = self.channels
        else:
            channels = [channel]
        for channel in channels:
            for subscriber in CHANNELS[channel]:
                if subscriber != self.socket.session.session_id:
                    session = self.socket.handler.server.sessions[subscriber]
                    self._write(message, session)