Initial commit
This commit is contained in:
commit
52f61b0bd1
4 files changed
+50
No files matched your search
Generated
+8
@@ -0,0 +1,8 @@
|
||||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
# Datasource local storage ignored files
|
||||
/dataSources/
|
||||
/dataSources.local.xml
|
||||
# Editor-based HTTP Client requests
|
||||
/httpRequests/
|
||||
Generated
+8
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="WEB_MODULE" version="4">
|
||||
<component name="NewModuleRootManager">
|
||||
<content url="file://$MODULE_DIR$" />
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
||||
Generated
+8
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/goTestProj.iml" filepath="$PROJECT_DIR$/.idea/goTestProj.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
||||
@@ -0,0 +1,26 @@
|
||||
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("/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")
|
||||
}
|
||||
Reference in new issue
Block a user