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

	for _, sub := range subs {
		sc, ok := ps.subClients[sub]
		if ok {
			sc[cl] = true
		} else {
			ps.subClients[sub] = map[stypes.Client]bool{cl: true}
			subCh := make(chan *types.Action)
			ps.subChs[sub] = subCh
			go ps.subSpin(sub)
		}
	}

	cs, ok := ps.clientSubs[cl]
	if !ok {
		cs = map[string]bool{}
		ps.clientSubs[cl] = cs
	}
	for _, sub := range subs {
		cs[sub] = true
	}
	return nil
}
// Subscribes a client so that they will receive push messages on the given
// subscriptions
Subscribes a client so that they will receive push messages on the given
subscriptions
// Subscribes a client so that they will receive push messages on the given // subscriptions
func (ps *PubSub) Subscribe(cl stypes.Client, subs ...string) error {
	ps.subLock.Lock()
	defer ps.subLock.Unlock()
	for _, sub := range subs {
		sc, ok := ps.subClients[sub]
		if ok {
			sc[cl] = true
		} else {
			ps.subClients[sub] = map[stypes.Client]bool{cl: true}
			subCh := make(chan *types.Action)
			ps.subChs[sub] = subCh
			go ps.subSpin(sub)
		}
	}
	cs, ok := ps.clientSubs[cl]
	if !ok {
		cs = map[string]bool{}
		ps.clientSubs[cl] = cs
	}
	for _, sub := range subs {
		cs[sub] = true
	}
	return nil
}
func ( ps * PubSub ) Subscribe ( cl stypes . Client , subs ... string ) error { ps . subLock . Lock ( ) defer ps . subLock . Unlock ( ) for _ , sub := range subs { sc , ok := ps . subClients [ sub ] if ok { sc [ cl ] = true } else { ps . subClients [ sub ] = map [ stypes . Client ] bool { cl : true } subCh := make ( chan * types . Action ) ps . subChs [ sub ] = subCh go ps . subSpin ( sub ) } } cs , ok := ps . clientSubs [ cl ] if ! ok { cs = map [ string ] bool { } ps . clientSubs [ cl ] = cs } for _ , sub := range subs { cs [ sub ] = true } return nil }
Subscribes a client so that they will receive push messages on the given
subscriptions
Subscribes a client so that they will receive push messages on the given subscriptions