package main

import (
	"DumplingServer/game"

	"github.com/gorilla/websocket"
	"github.com/wonderivan/logger"
)

//主函数入口
func main() {
	initLogger()
	initAPI()
	startServer()
}

//配置日志
func initLogger() {
	logger.SetLogger("./logs/log.json")
}

//设置只允许调用哪些API
func initAPI() {
	game.CheckServiceFuncMapBeforInvoke = true
	game.ServiceFuncMap["RequestEnterRoom"] = true
	game.ServiceFuncMap["UploadFrames"] = true
}

//开启服务监听
func startServer() {
	game.StartServer(11815, "/DumplingServer", func(conn *websocket.Conn) interface{} {
		return &game.Player{Conn: conn}
	})
}
