demo
This commit is contained in:
+5
-3
@@ -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)
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user