func (g *Game) handleMessage(ctx context.Context, m message.Message, send messageSender, active *bool, messageHandlers map[message.Type]messageHandler) {
	if g.Debug {
		g.log.Printf("game reading message with type %v", m.Type)
	}
	err := g.handleMessageHelper(ctx, m, send, active, messageHandlers)
	if err != nil {
		var mt message.Type
		switch err.(type) {
		case gameWarning:
			mt = message.SocketWarning
		default:
			mt = message.SocketError
		}
		m2 := message.Message{
			Type:       mt,
			PlayerName: m.PlayerName,
			Game:       m.Game,
			Info:       err.Error(),
		}
		send(m2)
	}
}
// handleMessage handles the message with the appropriate message handler.
handleMessage handles the message with the appropriate message handler.
// handleMessage handles the message with the appropriate message handler .
func (g *Game) handleMessage(ctx context.Context, m message.Message, send messageSender, active *bool, messageHandlers map[message.Type]messageHandler) {
	if g.Debug {
		g.log.Printf("game reading message with type %v", m.Type)
	}
	err := g.handleMessageHelper(ctx, m, send, active, messageHandlers)
	if err != nil {
		var mt message.Type
		switch err.(type) {
		case gameWarning:
			mt = message.SocketWarning
		default:
			mt = message.SocketError
		}
		m2 := message.Message{
			Type:       mt,
			PlayerName: m.PlayerName,
			Game:       m.Game,
			Info:       err.Error(),
		}
		send(m2)
	}
}
func ( g * Game ) handleMessage ( ctx context . Context , m message . Message , send messageSender , active * bool , messageHandlers map [ message . Type ] messageHandler ) { if g . Debug { g . log . Printf ( " " , m . Type ) } err := g . handleMessageHelper ( ctx , m , send , active , messageHandlers ) if err != nil { var mt message . Type switch err . ( type ) { case gameWarning : mt = message . SocketWarning default : mt = message . SocketError } m2 := message . Message { Type : mt , PlayerName : m . PlayerName , Game : m . Game , Info : err . Error ( ) , } send ( m2 ) } }
handleMessage handles the message with the appropriate message handler.
handleMessage handles the message with the appropriate message handler .