func (ps *PubSub) Unsubscribe(cl stypes.Client, subs ...string) error {
	ps.subLock.Lock()
	defer ps.subLock.Unlock()

	// If the client doesn't appear in clientSubs then it has no subs
	cs, ok := ps.clientSubs[cl]
	if !ok {
		return nil
	}

	for _, sub := range subs {
		delete(cs, sub)
		sc, ok := ps.subClients[sub]
		if !ok {
			gslog.Errorf("No subClients for sub %s", sub)
			continue
		}
		delete(sc, cl)
		if len(sc) == 0 {
			delete(ps.subClients, sub)
			close(ps.subChs[sub])
			delete(ps.subChs, sub)
		}
	}

	if len(cs) == 0 {
		delete(ps.clientSubs, cl)
	}

	return nil
}
// Unsubscribes a client so from the given subscriptions
Unsubscribes a client so from the given subscriptions
// Unsubscribes a client so from the given subscriptions
func (ps *PubSub) Unsubscribe(cl stypes.Client, subs ...string) error {
	ps.subLock.Lock()
	defer ps.subLock.Unlock()
	cs, ok := ps.clientSubs[cl]
	if !ok {
		return nil
	}
	for _, sub := range subs {
		delete(cs, sub)
		sc, ok := ps.subClients[sub]
		if !ok {
			gslog.Errorf("No subClients for sub %s", sub)
			continue
		}
		delete(sc, cl)
		if len(sc) == 0 {
			delete(ps.subClients, sub)
			close(ps.subChs[sub])
			delete(ps.subChs, sub)
		}
	}
	if len(cs) == 0 {
		delete(ps.clientSubs, cl)
	}
	return nil
}
func ( ps * PubSub ) Unsubscribe ( cl stypes . Client , subs ... string ) error { ps . subLock . Lock ( ) defer ps . subLock . Unlock ( ) cs , ok := ps . clientSubs [ cl ] if ! ok { return nil } for _ , sub := range subs { delete ( cs , sub ) sc , ok := ps . subClients [ sub ] if ! ok { gslog . Errorf ( " " , sub ) continue } delete ( sc , cl ) if len ( sc ) == 0 { delete ( ps . subClients , sub ) close ( ps . subChs [ sub ] ) delete ( ps . subChs , sub ) } } if len ( cs ) == 0 { delete ( ps . clientSubs , cl ) } return nil }
Unsubscribes a client so from the given subscriptions
Unsubscribes a client so from the given subscriptions
// If the client doesn't appear in clientSubs then it has no subs