internal

package
v0.0.0-...-bd4b760 Latest Latest
Warning

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

Go to latest
Published: May 15, 2023 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ServeWs

func ServeWs(hub *Hub, w http.ResponseWriter, r *http.Request)

ServeWs handles websocket requests from the peer.

Types

type Client

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

Client is a middleman between the websocket connection and the hub.

type ClientCommand

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

func NewClientCommand

func NewClientCommand(client uint64, message []byte) *ClientCommand

type Games

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

func InitGames

func InitGames(msghub messaging.MessageHub, engine *PersistenceEngine) *Games

func (*Games) Run

func (g *Games) Run(ctx context.Context, shutdownComplete func())

type Hub

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

Hub maintains the set of active clients and broadcasts messages to the clients.

func NewHub

func NewHub(msghub messaging.MessageHub, persistenceEngine *PersistenceEngine) *Hub

func (*Hub) ClosePersistenceEngine

func (h *Hub) ClosePersistenceEngine()

func (*Hub) DeregisterClientID

func (h *Hub) DeregisterClientID(ids []uint64)

called by session reaper

func (*Hub) Run

func (h *Hub) Run(ctx context.Context, shutdownComplete func())

type PersistenceEngine

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

func InitRedis

func InitRedis(redisHost, redisPassword string) *PersistenceEngine

func (*PersistenceEngine) Close

func (engine *PersistenceEngine) Close()

func (*PersistenceEngine) Delete

func (engine *PersistenceEngine) Delete(key string)

func (*PersistenceEngine) Get

func (engine *PersistenceEngine) Get(key string) ([]byte, error)

func (*PersistenceEngine) GetKeys

func (engine *PersistenceEngine) GetKeys(prefix string) ([]string, error)

func (*PersistenceEngine) Incr

func (engine *PersistenceEngine) Incr(counterKey string) (int, error)

func (*PersistenceEngine) Set

func (engine *PersistenceEngine) Set(key string, value []byte, expiry int) error

func (*PersistenceEngine) WaitForRedis

func (engine *PersistenceEngine) WaitForRedis()

wait for Redis to come up

type Quizzes

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

func InitQuizzes

func InitQuizzes(msghub messaging.MessageHub, engine *PersistenceEngine) (*Quizzes, error)

func (*Quizzes) Run

func (q *Quizzes) Run(ctx context.Context, shutdownComplete func())

type Sessions

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

func InitSessions

func InitSessions(msghub messaging.MessageHub, engine *PersistenceEngine, wsRegistry webSocketRegistry, auth *api.Auth, sessionTimeout int, reaperInterval int) *Sessions

func (*Sessions) Run

func (s *Sessions) Run(ctx context.Context, shutdownComplete func())

func (*Sessions) RunSessionReaper

func (s *Sessions) RunSessionReaper(ctx context.Context, shutdownComplete func())

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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