sockmap

package
v1.21.15 Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MemorySessionStore

type MemorySessionStore struct{}

func (MemorySessionStore) Del

func (s MemorySessionStore) Del(key string) error

func (MemorySessionStore) Get

func (s MemorySessionStore) Get(key string) (*SockSession, error)

func (MemorySessionStore) Set

func (s MemorySessionStore) Set(key string, value *SockSession) error

type RedisSessionStore

type RedisSessionStore struct {
	// contains filtered or unexported fields
}

func NewRedisSessionStore

func NewRedisSessionStore(addr string, ttl time.Duration, timeout time.Duration) (*RedisSessionStore, error)

func (*RedisSessionStore) Del

func (store *RedisSessionStore) Del(key string) error

func (*RedisSessionStore) Get

func (store *RedisSessionStore) Get(key string) (*SockSession, error)

func (*RedisSessionStore) Set

func (store *RedisSessionStore) Set(key string, value *SockSession) error

type SessionStore

type SessionStore interface {
	Set(key string, value *SockSession) error
	Get(key string) (*SockSession, error)
	Del(key string) error
}

type Sock

type Sock struct {
	SockId             string         `json:"sock_id"`
	Session            *SockSession   `json:"session"`
	Conn               io.WriteCloser `json:"conn"`
	JwtToken           string         `json:"jwt_token"`
	*types.User        `json:"user"`
	*jwtservice.Claims `json:"claims"`
	// contains filtered or unexported fields
}

func (*Sock) AddListener

func (s *Sock) AddListener(path string)

func (*Sock) Delete

func (s *Sock) Delete() error

func (*Sock) GetFilter

func (s *Sock) GetFilter() *types.Filter

func (*Sock) HandleMessage

func (s *Sock) HandleMessage(msg *SockMessage)

func (*Sock) HasListener

func (s *Sock) HasListener(path string) bool

func (*Sock) IsExpired

func (s *Sock) IsExpired() bool

func (*Sock) IsPaused

func (s *Sock) IsPaused() bool

func (*Sock) LoadSession

func (s *Sock) LoadSession()

func (*Sock) RemoveListener

func (s *Sock) RemoveListener(path string)

func (*Sock) SendLog

func (s *Sock) SendLog(lg *_types.Log) error

func (*Sock) SetFilter

func (s *Sock) SetFilter(f *types.Filter)

func (*Sock) SetPaused

func (s *Sock) SetPaused(state bool)

func (*Sock) SetStore

func (s *Sock) SetStore(store SessionStore)

type SockMap

type SockMap struct {
	// contains filtered or unexported fields
}

func NewSockMap

func NewSockMap() *SockMap

func (*SockMap) GetSock

func (sm *SockMap) GetSock(userId int, sockId string) *Sock

func (*SockMap) GetSocks

func (sm *SockMap) GetSocks(userId int) *cmap.ConcurrentMap[string, *Sock]

func (*SockMap) Push

func (sm *SockMap) Push(lg *_types.Log) int

func (*SockMap) Register

func (sm *SockMap) Register(s *Sock)

func (*SockMap) SetFilter

func (sm *SockMap) SetFilter(userId int, sockId string, filter *types.Filter) bool

func (*SockMap) SetSessionStore

func (sm *SockMap) SetSessionStore(store SessionStore)

func (*SockMap) String

func (sm *SockMap) String() string

func (*SockMap) Unregister

func (sm *SockMap) Unregister(s *Sock)

type SockMessage

type SockMessage struct {
	Action  string      `json:"action,omitempty"`
	Path    string      `json:"path"`
	Payload interface{} `json:"payload"`
}

type SockSession

type SockSession struct {
	Paused        bool           `json:"paused"`
	Listeners     map[string]int `json:"listeners"`
	*types.Filter `json:"filter"`
}

Jump to

Keyboard shortcuts

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