This commit is contained in:
eson 2023-08-16 14:04:08 +08:00
parent 3ba0a631bd
commit 456dae6409
3 changed files with 12 additions and 5 deletions

2
go.mod
View File

@ -4,7 +4,7 @@ go 1.20
require ( require (
github.com/474420502/execute v0.2.2 github.com/474420502/execute v0.2.2
github.com/474420502/passer v0.0.3 github.com/474420502/passer v0.0.4
github.com/gorilla/websocket v1.5.0 github.com/gorilla/websocket v1.5.0
github.com/lni/dragonboat/v4 v4.0.0-20230709075559-54497b9553be github.com/lni/dragonboat/v4 v4.0.0-20230709075559-54497b9553be
) )

4
go.sum
View File

@ -2,8 +2,8 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMT
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
github.com/474420502/execute v0.2.2 h1:Hzzb/HFa/urRvi3xWe+p/DnJgRyxXFVyEBEXbbITy/E= github.com/474420502/execute v0.2.2 h1:Hzzb/HFa/urRvi3xWe+p/DnJgRyxXFVyEBEXbbITy/E=
github.com/474420502/execute v0.2.2/go.mod h1:wkKeKBIXYp7T844eU1YS2nPvFj8lra4VRcQYnWyXej4= github.com/474420502/execute v0.2.2/go.mod h1:wkKeKBIXYp7T844eU1YS2nPvFj8lra4VRcQYnWyXej4=
github.com/474420502/passer v0.0.3 h1:ACsKTcAdzjC+LA88me37WYNYr8QzlNLI2dRpLhhyiJQ= github.com/474420502/passer v0.0.4 h1:i3g7p6jQG9/Gmxvd+WlnPX67Qv3VWBGdohqCullsfAk=
github.com/474420502/passer v0.0.3/go.mod h1:MmnnrF9d51sPkFzdRq2pQtxQKqyjburVM1LjMbOCezE= github.com/474420502/passer v0.0.4/go.mod h1:MmnnrF9d51sPkFzdRq2pQtxQKqyjburVM1LjMbOCezE=
github.com/474420502/random v0.4.1 h1:HUUyLXRWMijVb7CJoEC16f0aFQOW25Lkr80Mut6PoKU= github.com/474420502/random v0.4.1 h1:HUUyLXRWMijVb7CJoEC16f0aFQOW25Lkr80Mut6PoKU=
github.com/474420502/requests v1.41.0 h1:c5OfhVHCvETlwEhODO2OAdPOH7v//kXJkGGUTKOkLOU= github.com/474420502/requests v1.41.0 h1:c5OfhVHCvETlwEhODO2OAdPOH7v//kXJkGGUTKOkLOU=
github.com/474420502/requests v1.41.0/go.mod h1:2SCVzim0ONFYG09g/GrM7RTeJIC6qTyZfnohsjnG5C8= github.com/474420502/requests v1.41.0/go.mod h1:2SCVzim0ONFYG09g/GrM7RTeJIC6qTyZfnohsjnG5C8=

View File

@ -1,6 +1,7 @@
package fusenrender_test package fusenrender_test
import ( import (
"encoding/json"
"fmt" "fmt"
"fusenrender" "fusenrender"
"io" "io"
@ -37,13 +38,19 @@ func TestWebsocketC(t *testing.T) {
fusenrender.StartNode(svc) fusenrender.StartNode(svc)
} }
var addr = "api.fusen.3718.cn:4050" // var addr = "api.fusen.3718.cn:4050"
var addr = "localhost:4050"
func TestWebsocketCient(t *testing.T) { func TestWebsocketCient(t *testing.T) {
// u := url.URL{Scheme: "ws", Host: addr, Path: "/ws/pop/queue"} // u := url.URL{Scheme: "ws", Host: addr, Path: "/ws/pop/queue"}
// conn, _, err := websocket.DefaultDialer.Dial(u.String(), nil) // conn, _, err := websocket.DefaultDialer.Dial(u.String(), nil)
// log.Println(err) // log.Println(err)
// defer conn.Close() // defer conn.Close()
var m any
err := json.Unmarshal([]byte(sendjson), &m)
if err != nil {
panic(err)
}
go func() { go func() {
C := time.NewTicker(time.Second * 5) C := time.NewTicker(time.Second * 5)
@ -52,7 +59,7 @@ func TestWebsocketCient(t *testing.T) {
Group: "unity3d", Group: "unity3d",
CreateAt: time.Now(), CreateAt: time.Now(),
Data: sendjson, Data: m,
} }
r, err := requests.Post(fmt.Sprintf("http://%s/api/render/queue/push", addr)).SetBodyJson(item).Execute() r, err := requests.Post(fmt.Sprintf("http://%s/api/render/queue/push", addr)).SetBodyJson(item).Execute()
log.Println(r, err) log.Println(r, err)