Documentation ¶
Index ¶
- type Dispatcher
- func (d *Dispatcher) BootstrapDispatcher()
- func (d *Dispatcher) HandleIdleTimeoutCheck()
- func (d *Dispatcher) LoadFromState() error
- func (d *Dispatcher) ServeHTTP(w http.ResponseWriter, r *http.Request)
- func (d *Dispatcher) StartNewGameServer(title string, cardDeck *messaging.CardDeckType, overrideID string, ...) *game.Server
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Dispatcher ¶
type Dispatcher struct { ID string GameServers map[string]*game.Server AMQPClient *rabbitmq.Client RedisClient *redis.Client OutgoingMessages chan *messaging.Container // contains filtered or unexported fields }
Dispatcher creates new game servers for open games
func NewDispatcher ¶
func NewDispatcher( id string, metricsCollector *instrumentation.MetricsCollector, redisURL string, redisPass string, amqpURL string, amqpUser string, amqpPass string, sessionsURL string, ) (*Dispatcher, error)
NewDispatcher creates a new dispatcher object
func (*Dispatcher) BootstrapDispatcher ¶
func (d *Dispatcher) BootstrapDispatcher()
BootstrapDispatcher starts the asynchronus goroutines for managing messages
func (*Dispatcher) HandleIdleTimeoutCheck ¶
func (d *Dispatcher) HandleIdleTimeoutCheck()
HandleIdleTimeoutCheck checks game servers for idle timeout and shuts them down if applicable
func (*Dispatcher) LoadFromState ¶
func (d *Dispatcher) LoadFromState() error
LoadFromState starts all persisted game servers from redis
func (*Dispatcher) ServeHTTP ¶
func (d *Dispatcher) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP satisfies the http handler interface
func (*Dispatcher) StartNewGameServer ¶
func (d *Dispatcher) StartNewGameServer( title string, cardDeck *messaging.CardDeckType, overrideID string, loadedFromState bool, ) *game.Server
StartNewGameServer creates a new GameDispatcher and runs it in a new goroutine
Click to show internal directories.
Click to hide internal directories.