first version

This commit is contained in:
Ola Holmström
2015-05-13 22:37:17 +02:00
commit fb9197b6ff
12 changed files with 648 additions and 0 deletions
+26
View File
@@ -0,0 +1,26 @@
package main
import (
"../../"
"github.com/gin-gonic/gin"
"net/http"
)
func main() {
r := gin.Default()
m := melody.Default()
r.GET("/", func(c *gin.Context) {
http.ServeFile(c.Writer, c.Request, "index.html")
})
r.GET("/ws", func(c *gin.Context) {
m.HandleRequest(c.Writer, c.Request)
})
m.HandleMessage(func(s *melody.Session, msg []byte) {
m.Broadcast(msg)
})
r.Run(":5000")
}