You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

25 lines
608 B

package main
import (
"ginchat/models"
"ginchat/router" // router "ginchat/router"
"ginchat/utils"
"time"
"github.com/spf13/viper"
)
func main() {
utils.InitConfig()
utils.InitMySQL()
utils.InitRedis()
InitTimer()
r := router.Router() // router.Router()
r.Run(viper.GetString("port.server")) // listen and serve on 0.0.0.0:8080 (for windows "localhost:8080")
}
//初始化定时器
func InitTimer() {
utils.Timer(time.Duration(viper.GetInt("timeout.DelayHeartbeat"))*time.Second, time.Duration(viper.GetInt("timeout.HeartbeatHz"))*time.Second, models.CleanConnection, "")
}