diff --git a/sam/websocket/session.go b/sam/websocket/session.go index fafe6697f..479da6002 100644 --- a/sam/websocket/session.go +++ b/sam/websocket/session.go @@ -38,7 +38,7 @@ func (Session) New(ctx context.Context, conn *websocket.Conn) *Session { conn: conn, ctx: ctx, config: config, - subs: Subscriptions{}.New(), + subs: NewSubscriptions(), send: make(chan []byte, 512), stop: make(chan []byte, 1), } diff --git a/sam/websocket/store.go b/sam/websocket/session_store.go similarity index 93% rename from sam/websocket/store.go rename to sam/websocket/session_store.go index f17dfd2a5..5e625bba4 100644 --- a/sam/websocket/store.go +++ b/sam/websocket/session_store.go @@ -13,14 +13,14 @@ type ( } ) -func (Store) New() *Store { +func NewStore() *Store { return &Store{sync.RWMutex{}, make(map[uint64]*Session)} } var store *Store func init() { - store = Store{}.New() + store = NewStore() } func (s *Store) Save(session *Session) *Session { diff --git a/sam/websocket/session_subscriptions.go b/sam/websocket/session_subscriptions.go index 199d9f5fa..170b380cf 100644 --- a/sam/websocket/session_subscriptions.go +++ b/sam/websocket/session_subscriptions.go @@ -19,7 +19,7 @@ type ( } ) -func (Subscriptions) New() *Subscriptions { +func NewSubscriptions() *Subscriptions { return &Subscriptions{sync.RWMutex{}, make(map[string]*Subscription)} }