Removed unnecessary endpoint

This commit is contained in:
Lucas Winther committed 2021-07-18 18:14:07 +02:00
1 parent 284aa71ab7
commit 73ec0a426d
1 file changed
+2 -6
+2 -6
View File
@@ -3,24 +3,20 @@ package main
import (
"github.com/gin-gonic/gin"
"gopkg.in/olahol/melody.v1"
"net/http"
)
func main() {
r := gin.Default()
m := melody.New()
r.GET("/", func(c *gin.Context) {
http.ServeFile(c.Writer, c.Request, "index.html")
})
r.GET("/:name/ws", func(c *gin.Context) {
m.HandleRequest(c.Writer, c.Request)
})
m.HandleMessage(func(s *melody.Session, msg []byte) {
// Send message to all participants on url other than me.
m.BroadcastFilter(msg, func(q *melody.Session) bool {
return q.Request.URL.Path == s.Request.URL.Path
return (q.Request.URL.Path == s.Request.URL.Path) && (s != q)
})
})