package main import ( "log" "net/http" "github.com/gin-gonic/gin" ) // ///////// Priority func (w *Webapp) GetPriority(c *gin.Context) { log.Printf("send priority %s", w.Stream.StatusPriority) c.JSON(http.StatusOK, w.Stream.StatusPriority) } func (w *Webapp) SetPriority(c *gin.Context) { var msg Message var err error log.Printf("set priority %s", c.Request.Body) err = c.ShouldBind(&msg) if err != nil { log.Printf("req error: %+v", err) c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()}) return } c.JSON(http.StatusOK, "OK") log.Printf("msg %+v", msg) w.Stream.StatusPriority = msg.Priority w.Stream.SendPriority(msg.Priority) }