Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Session ¶
type Session struct {
// contains filtered or unexported fields
}
Session represents a single WS connection or a long polling session. A user may have multiple sessions.
type SessionStore ¶
type SessionStore struct {
// contains filtered or unexported fields
}
SessionStore holds live sessions. Long polling sessions are stored in a linked list with most recent sessions on top. In addition, all sessions are stored in a map indexed by session ID.
func NewSessionStore ¶
func NewSessionStore(lifetime time.Duration) *SessionStore
NewSessionStore initializes a session store.
func (*SessionStore) Delete ¶
func (ss *SessionStore) Delete(s *Session)
Delete removes session from store.
func (*SessionStore) Get ¶
func (ss *SessionStore) Get(sid string) *Session
Get fetches a session from store by session ID.
func (*SessionStore) NewSession ¶
func (ss *SessionStore) NewSession(conn any, sid string) (*Session, int)
NewSession creates a new session and saves it to the session store.
func (*SessionStore) Range ¶
func (ss *SessionStore) Range(f func(sid string, s *Session) bool)
Range calls given function for all sessions. It stops if the function returns false.
func (*SessionStore) Shutdown ¶
func (ss *SessionStore) Shutdown()
Shutdown terminates sessionStore. No need to clean up. Don't send to clustered sessions, their servers are not being shut down.