Working authenticated connection

This commit is contained in:
2023-09-18 20:58:15 -05:00
parent 11b176dcbc
commit c89756630f
10 changed files with 126 additions and 62 deletions

View File

@ -1,7 +1,7 @@
package store
import (
"github.com/thesyncim/faye/subscription"
"github.com/thesyncim/fayec/subscription"
"sync"
)
@ -26,8 +26,8 @@ func (s *SubscriptionsStore) Add(sub *subscription.Subscription) {
s.mutex.Unlock()
}
//Match returns the subscriptions that match with the specified channel name
//Wildcard subscriptions are matched
// Match returns the subscriptions that match with the specified channel name
// Wildcard subscriptions are matched
func (s *SubscriptionsStore) Match(channel string) []*subscription.Subscription {
var (
matches []*subscription.Subscription
@ -70,7 +70,7 @@ end:
s.mutex.Unlock()
}
//RemoveAll removel all subscriptions and close all channels
// RemoveAll removel all subscriptions and close all channels
func (s *SubscriptionsStore) RemoveAll() {
s.mutex.Lock()
for i := range s.subs {
@ -84,7 +84,7 @@ func (s *SubscriptionsStore) RemoveAll() {
s.mutex.Unlock()
}
//Count return the number of subscriptions associated with the specified channel
// Count return the number of subscriptions associated with the specified channel
func (s *SubscriptionsStore) Count(channel string) int {
return len(s.Match(channel))
}

View File

@ -7,8 +7,8 @@ import (
)
var (
wildcardSubscription, _ = subscription.NewSubscription("a", "/wildcard/*", nil, nil, nil)
simpleSubscription, _ = subscription.NewSubscription("b", "/foo/bar", nil, nil, nil)
wildcardSubscription, _ = subscription.NewSubscription("a", nil, nil)
simpleSubscription, _ = subscription.NewSubscription("b", nil, nil)
)
func TestStore_Add(t *testing.T) {