func (t *Topic) Unregister(ch chan<- interface{}) {
	t.lock.Lock()
	defer t.lock.Unlock()
	_, ok := t.connections[ch]
	if ok {
		delete(t.connections, ch)
		close(ch)
	}
}
Unregister stops receiving messages on this channel.
package topic
import (
	"sync"
)
type nothing struct{}
type Topic struct {
	Broadcast chan<- interface{}
	lock        sync.Mutex
	connections map[chan<- interface{}]nothing
}
func New() *Topic {
	t := &Topic{}
	broadcast := make(chan interface{}, 100)
	t.Broadcast = broadcast
	t.connections = make(map[chan<- interface{}]nothing)
	go t.run(broadcast)
	return t
}
func (t *Topic) run(broadcast <-chan interface{}) {
	for msg := range broadcast {
		func() {
			t.lock.Lock()
			defer t.lock.Unlock()
			for ch, _ := range t.connections {
				select {
				case ch <- msg:
				default:
					delete(t.connections, ch)
					close(ch)
				}
			}
		}()
	}
	t.lock.Lock()
	defer t.lock.Unlock()
	for ch, _ := range t.connections {
		delete(t.connections, ch)
		close(ch)
	}
}
func (t *Topic) Register(ch chan<- interface{}) {
	t.lock.Lock()
	defer t.lock.Unlock()
	t.connections[ch] = nothing{}
}