server

package
v0.0.0-...-0d5d2da Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2024 License: GPL-3.0 Imports: 110 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run()

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.

Jump to

Keyboard shortcuts

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