websocket base and command parser

This commit is contained in:
zomo
2026-01-06 23:43:14 -06:00
parent 81e8bca787
commit a6d932a560
5 changed files with 314 additions and 12 deletions

View File

@@ -90,6 +90,14 @@ func (server *ApiServer) loadEndpoints() {
c.AbortWithStatus(http.StatusBadRequest)
}
})
server.engine.Any("/ws", func(c *gin.Context) {
err := server.ws.Handle(c.Writer, c.Request)
if err != nil {
log.Printf("Error handing websocket connection from %s: %v", c.RemoteIP(), err)
c.AbortWithStatus(http.StatusInternalServerError)
}
})
}
type ServerInfo struct {