// Broadcast emits an event with data to ALL active connections.
766320
func (hub *Hub) Broadcast(event string, data interface{}) {
	hub.broadcast <- &message{
		event: event,
		data:  data,
	}
}
188116
func (l *Forwarder) EmitAuditEvent(event Event, fields EventFields) error {
	err := UpdateEventFields(event, fields, l.Clock, l.UID)
	if err != nil {
		return trace.Wrap(err)
	}
	data, err := json.Marshal(fields)
	if err != nil {
		return trace.Wrap(err)
	}
	chunks := []*SessionChunk{
		{
			EventType: event.Name,
			Data:      data,
			Time:      time.Now().UTC().UnixNano(),
		},
	}
	return l.PostSessionSlice(SessionSlice{
		Namespace: l.Namespace,
		SessionID: string(l.SessionID),
		Version:   V3,
		Chunks:    chunks,
	})
}
213802
func broadcast(msg string) uint {
	var cnt uint

	// move the utmp file pointer to the beginning of the utmp file
	C.setutent()

	// loop until we're out of utmp lines
	for {
		// read another line from the utmp file
		var utmp *C.struct_utmp
		utmp = C.getutent()
		if utmp == nil {
			// if no struct was returned, then there are no more lines and we're
			// done
			break
		}

		// get the device name of this user's tty out of the utmp struct
		line := C.GoString(&utmp.ut_line[0])
		tty, _ := os.OpenFile("/dev/"+line, os.O_WRONLY, 0)
		if tty == nil {
			// if we couldn't open the tty for this user, skip this user
			continue
		}
		// increment the counter of lines successfully opened
		cnt++
		// attempt to (asynchronously) write to the tty
		go func() {
			fmt.Fprintf(tty, "\r%79s\r\n", " ")
			fmt.Fprintf(tty, "%-79.79s\007\007\r\n", fmt.Sprintf("Broadcast message from locksmithd at %s:", time.Now()))
			fmt.Fprintf(tty, "%-79.79s\r\n", msg) // msg is assumed to be short and not require wrapping
			fmt.Fprintf(tty, "\r%79s\r\n", " ")
			tty.Close()
		}()
	}

	return cnt
}
1119223
func (r *Room) Emit(event string, data interface{}) {
	r.send <- &message{
		event: event,
		data:  data,
	}
}
1116604
func (s *server) Broadcast(srv ab.AtomicBroadcast_BroadcastServer) error {
	logger.Debugf("Starting new Broadcast handler")
	defer func() {
		if r := recover(); r != nil {
			logger.Criticalf("Broadcast client triggered panic: %s\n%s", r, debug.Stack())
		}
		logger.Debugf("Closing Broadcast stream")
	}()
	return s.bh.Handle(&broadcastMsgTracer{
		AtomicBroadcast_BroadcastServer: srv,
		msgTracer: msgTracer{
			debug:    s.debug,
			function: "Broadcast",
		},
	})
}
652462
func (srv *Instance) PublishEvent(e lifecycle.Event) error {
	return lifecycle.PublishEvent(e, srv.connector)
}
201574
func (self *SocketHandler) Emit(record *LogRecord) error {
	self.Format(record)
	bin, err := self.Marshal(record)
	if err != nil {
		return err
	}
	return self.sendFunc(bin)
}
1230007
func (r *eventRegistry) Emit(e Event, args ...interface{}) {
	r.mutex.RLock()
	defer r.mutex.RUnlock()

	for _, h := range r.handlers[e] {
		if err := r.callHandler(h.MsgHandler, args...); err != nil {
			Logf("emitting %s failed: %s", e, err)
		}
	}
}
903089
func (se *Engine) broadcast(created, altered, dropped []string) {
	s := make(map[string]*Table, len(se.tables))
	for k, v := range se.tables {
		s[k] = v
	}
	for _, f := range se.notifiers {
		f(s, created, altered, dropped)
	}
}
938434
func (l *AuditLog) emitEvent(e AuditLogEvent) {
	if l.EventsC == nil {
		return
	}
	select {
	case l.EventsC <- &e:
		return
	default:
		l.Warningf("Blocked on the events channel.")
	}
}
1305463
func (ipv4 IPv4Addr) Broadcast() IPAddr {
	// Nothing should listen on a broadcast address.
	return IPv4Addr{
		Address: IPv4Address(ipv4.BroadcastAddress()),
		Mask:    IPv4HostMask,
	}
}
1342241
func (c *ChannelCond) Broadcast() {
	var old chan struct{}
	c.Lock()
	defer c.Unlock()
	c.c, old = make(chan struct{}), c.c
	close(old)
}
480992
func (h *Hub) Publish(e Event) {
	h.m.RLock()
	if handlers, ok := h.subscribers[e.Kind()]; ok {
		for _, h := range handlers {
			h.f(e)
		}
	}
	h.m.RUnlock()
}
616570
func (self *StreamHandler) Emit2(
	handler Handler, record *LogRecord) error {

	message := handler.Format(record)
	if err := self.stream.Write(message); err != nil {
		return err
	}
	return nil
}
1187447
func (b *EventBus) PublishEvent(ctx context.Context, event eh.Event) error {
	e := evt{
		AggregateID:   event.AggregateID().String(),
		AggregateType: event.AggregateType(),
		EventType:     event.EventType(),
		Version:       event.Version(),
		Timestamp:     event.Timestamp(),
		Context:       eh.MarshalContext(ctx),
	}

	// Marshal event data if there is any.
	if event.Data() != nil {
		rawData, err := bson.Marshal(event.Data())
		if err != nil {
			return errors.New("could not marshal event data: " + err.Error())
		}
		e.RawData = bson.Raw{Kind: 3, Data: rawData}
	}

	// Marshal the event (using BSON for now).
	data, err := bson.Marshal(e)
	if err != nil {
		return errors.New("could not marshal event: " + err.Error())
	}

	// NOTE: Using a new context here.
	// TODO: Why?
	publishCtx := context.Background()
	res := b.topic.Publish(publishCtx, &pubsub.Message{
		Data: data,
	})
	if _, err := res.Get(publishCtx); err != nil {
		return errors.New("could not publish event: " + err.Error())
	}

	return nil
}
322563
func (ipv4 IPv4Addr) BroadcastAddress() IPv4Network {
	return IPv4Network(uint32(ipv4.Address)&uint32(ipv4.Mask) | ^uint32(ipv4.Mask))
}
1174486
func (a *AsyncEventEmitter) EmitEvent(event Event) {
	a.listenersLock.RLock()
	for _, listener := range a.listeners {
		go listener.HandleEvent(event)
	}
	a.listenersLock.RUnlock()
}