switch.go
func (sw *Switch) Broadcast(chID byte, msg interface{}) chan bool {
	successChan := make(chan bool, len(sw.peers.List()))
	log.Debug("Broadcast", "channel", chID, "msg", msg)
	for _, peer := range sw.peers.List() {
		go func(peer *Peer) {
			success := peer.Send(chID, msg)
			successChan <- success
		}(peer)
	}
	return successChan
}
func (sw *Switch) Broadcast(chID byte, msg interface{}) chan bool {
	successChan := make(chan bool, len(sw.peers.List()))
	log.Debug("Broadcast", "channel", chID, "msg", msg)
	for _, peer := range sw.peers.List() {
		go func(peer *Peer) {
			success := peer.Send(chID, msg)
			successChan <- success
		}(peer)
	}
	return successChan
}
func ( sw * Switch ) Broadcast ( chID byte , msg interface { } ) chan bool { successChan := make ( chan bool , len ( sw . peers . List ( ) ) ) log . Debug ( " " , " " , chID , " " , msg ) for _ , peer := range sw . peers . List ( ) { go func ( peer * Peer ) { success := peer . Send ( chID , msg ) successChan <- success } ( peer ) } return successChan }
// Broadcast runs a go routine for each attempted send, which will block
// trying to send for defaultSendTimeoutSeconds. Returns a channel
// which receives success values for each attempted send (false if times out)
// NOTE: Broadcast uses goroutines, so order of broadcast may not be preserved.
Broadcast runs a go routine for each attempted send which will block trying to send for defaultSendTimeoutSeconds . Returns a channel which receives success values for each attempted send ( false if times out ) NOTE : Broadcast uses goroutines so order of broadcast may not be preserved .