func (cfg RunnerConfig) NewRunner(log log.Logger) (*Runner, error) {
	if err := cfg.validate(log); err != nil {
		return nil, fmt.Errorf("creating socket runner: validation: %w", err)
	}
	u := gorilla.NewUpgrader()
	uf := func(w http.ResponseWriter, r *http.Request) (Conn, error) {
		return u.Upgrade(w, r)
	}
	r := Runner{
		log:           log,
		upgradeFunc:   uf,
		playerSockets: make(map[player.Name]map[message.Addr]chan<- message.Message, cfg.MaxSockets),
		playerGames:   make(map[player.Name]map[game.ID]message.Addr),
		RunnerConfig:  cfg,
	}
	return &r, nil
}
// NewRunner creates a new socket runner from the config.
NewRunner creates a new socket runner from the config.
// NewRunner creates a new socket runner from the config .
func (cfg RunnerConfig) NewRunner(log log.Logger) (*Runner, error) {
	if err := cfg.validate(log); err != nil {
		return nil, fmt.Errorf("creating socket runner: validation: %w", err)
	}
	u := gorilla.NewUpgrader()
	uf := func(w http.ResponseWriter, r *http.Request) (Conn, error) {
		return u.Upgrade(w, r)
	}
	r := Runner{
		log:           log,
		upgradeFunc:   uf,
		playerSockets: make(map[player.Name]map[message.Addr]chan<- message.Message, cfg.MaxSockets),
		playerGames:   make(map[player.Name]map[game.ID]message.Addr),
		RunnerConfig:  cfg,
	}
	return &r, nil
}
func ( cfg RunnerConfig ) NewRunner ( log log . Logger ) ( * Runner , error ) { if err := cfg . validate ( log ) ; err != nil { return nil , fmt . Errorf ( " " , err ) } u := gorilla . NewUpgrader ( ) uf := func ( w http . ResponseWriter , r * http . Request ) ( Conn , error ) { return u . Upgrade ( w , r ) } r := Runner { log : log , upgradeFunc : uf , playerSockets : make ( map [ player . Name ] map [ message . Addr ] chan <- message . Message , cfg . MaxSockets ) , playerGames : make ( map [ player . Name ] map [ game . ID ] message . Addr ) , RunnerConfig : cfg , } return & r , nil }
NewRunner creates a new socket runner from the config.
NewRunner creates a new socket runner from the config .