This commit is contained in:
hoteas
2017-08-23 01:40:54 +00:00
parent 043dc226dc
commit 6940609ad2
3 changed files with 277 additions and 82 deletions
+5 -3
View File
@@ -3,6 +3,7 @@ package main
import (
"database/sql"
"fmt"
_ "github.com/go-sql-driver/mysql"
"go.hoteas.com/hotime"
"golang.org/x/net/websocket"
)
@@ -48,11 +49,12 @@ func main() {
"app": hotime.Proj{
"index": hotime.Ctr{
"test": func(this *hotime.Context) {
this.Display(0, "chenggong")
},
"websocket": func(this *hotime.Context) {
hdler:=websocket.Handler(func(ws *websocket.Conn) {
for true {
hdler := websocket.Handler(func(ws *websocket.Conn) {
for true {
msg := make([]byte, 5120)
n, err := ws.Read(msg)
@@ -69,7 +71,7 @@ func main() {
fmt.Printf("Send: %s\n", msg[:m])
}
})
hdler.ServeHTTP(this.Resp,this.Req)
hdler.ServeHTTP(this.Resp, this.Req)
},
},
},