Handeling websocket disconnect

This commit is contained in:
2023-09-19 10:19:04 -05:00
parent 8f0db70487
commit 832e02f42f
6 changed files with 46 additions and 14 deletions

View File

@ -84,6 +84,19 @@ func (s *SubscriptionsStore) RemoveAll() {
s.mutex.Unlock()
}
func (s *SubscriptionsStore) GetAll() []*subscription.Subscription {
s.mutex.Lock()
subsList := make([]*subscription.Subscription, 0)
for i := range s.subs {
//close all listeners
for j := range s.subs[i] {
subsList = append(subsList, s.subs[i][j])
}
}
s.mutex.Unlock()
return subsList
}
// 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

@ -1,7 +1,7 @@
package store
import (
"github.com/thesyncim/faye/subscription"
"gitea.watsonlabs.net/watsonb8/fayec/subscription"
"reflect"
"testing"
)