···6262 return b.topID
6363}
64646565-// Unsubscribes removes a subscription for a topic using the given id. Returns true on success, false if the topic or id was not found.
6666-func (b *Bus) Unsubscribe(topic string, id int) bool {
6767- if t, ok := b.topics[topic]; ok {
6565+// Unsubscribes removes a subscription for a topic using the given id. Returns the number of subscriptions removed.
6666+func (b *Bus) Unsubscribe(topic string, id int) (count int) {
6767+ for _, t := range b.topics {
6868 for index, s := range t.subscriptions {
6969 if s.id == id {
7070 t.subscriptions = append(t.subscriptions[:index], t.subscriptions[index+1:]...)
7171- return true
7171+ count++
7272+ break
7273 }
7374 }
7475 }
7575- return false
7676+ return count
7677}
77787879type Subscription struct {