package server import ( "artNet/cert" "fmt" "github.com/gin-gonic/gin" ) type Server struct { Routes *gin.Engine } type Send struct { Set []Set `json:"subscribe"` } type Set struct { Path string `json:"path"` OnChange bool `json:"onChange"` Depth int `json:"depth"` Driver string `json:"driver"` } // Initialize new websocket server func NewServer() *Server { return &Server{ Routes: gin.Default(), } } func (s *Server) ServeHttp(port uint) error { return s.Routes.Run(fmt.Sprintf(":%d", port)) } func (s *Server) ServeHttps(port uint, cert cert.Cert) error { return s.Routes.RunTLS(fmt.Sprintf(":%d", port), cert.CertFile, cert.KeyFile) }