wb

package
v0.0.0-...-ada65e5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 2, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Init

func Init()

Types

type ProxyReqType

type ProxyReqType int

ProxyReqType is the type of proxy requests.

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL