bus

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2024 License: AGPL-3.0 Imports: 31 Imported by: 0

Documentation

Overview

Package bus is the message bus. This package listens on various NATS channels for requests and publishes back responses to the same, or other channels. Responsible for talking to the liwords-socket server.

Index

Constants

View Source
const (
	MaxMessageLength = 500

	AdjudicateInterval     = 10 * time.Second
	GamesCounterInterval   = 60 * time.Minute
	SeeksExpireInterval    = 10 * time.Minute
	ChannelMonitorInterval = 5 * time.Second
	// Cancel a game if it hasn't started after this much time.
	CancelAfter = 60 * time.Second
)
View Source
const (
	BotRequestID = "bot-request"
)
View Source
const GameEventStreamPrefix = "/api/game/eventstream/"
View Source
const (
	TournamentReadyExpire = 3600
)
View Source
const UserEventStreamPrefix = "/api/eventstream/"

Variables

View Source
var BootedReceiversMax = 5

Functions

This section is empty.

Types

type Bus

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

Bus is the struct; it should contain all the stores to verify messages, etc.

func NewBus

func NewBus(cfg *config.Config, natsconn *nats.Conn, stores *stores.Stores, redisPool *redis.Pool) (*Bus, error)

func (*Bus) EventAPIServerInstance

func (b *Bus) EventAPIServerInstance() *EventAPIServer

func (*Bus) GameEventChannel

func (b *Bus) GameEventChannel() chan *entity.EventWrapper

func (*Bus) ProcessMessages

func (b *Bus) ProcessMessages(ctx context.Context)

ProcessMessages is very similar to the PubsubProcess in liwords-socket, but that's because they do similar things.

func (*Bus) TournamentEventChannel

func (b *Bus) TournamentEventChannel() chan *entity.EventWrapper

type EventAPIServer

type EventAPIServer struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func NewEventApiServer

func NewEventApiServer(ustore user.Store, gstore gameplay.GameStore) *EventAPIServer

func (*EventAPIServer) ServeHTTP

func (s *EventAPIServer) ServeHTTP(w http.ResponseWriter, r *http.Request)

Jump to

Keyboard shortcuts

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