Documentation ¶
Index ¶
- func Run()
- type Session
- type SessionProto
- type SessionStore
- func (ss *SessionStore) Delete(s *Session)
- func (ss *SessionStore) EvictUser(uid types.Uid, skipSid string)
- func (ss *SessionStore) Get(sid string) *Session
- func (ss *SessionStore) NewSession(conn any, sid string) (*Session, int)
- func (ss *SessionStore) Range(f func(sid string, s *Session) bool)
- func (ss *SessionStore) Shutdown()
- type Subscription
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 SessionProto ¶
type SessionProto int
SessionProto is the type of the wire transport.
const ( // NONE is undefined/not set. NONE SessionProto = iota // WEBSOCK represents websocket connection. WEBSOCK // LPOLL represents a long polling connection. LPOLL )
Constants defining individual types of wire transports.
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) EvictUser ¶
func (ss *SessionStore) EvictUser(uid types.Uid, skipSid string)
EvictUser terminates all sessions of a given user.
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.
type Subscription ¶
type Subscription struct {
// contains filtered or unexported fields
}
Subscription is a mapper of sessions to topics.