diff options
author | Valery Piashchynski <[email protected]> | 2021-06-09 20:00:23 +0300 |
---|---|---|
committer | Valery Piashchynski <[email protected]> | 2021-06-09 20:00:23 +0300 |
commit | ec9b71c5468d8a6f1b999a35dca6e78af55b9895 (patch) | |
tree | a4201534f29c47cb1059627888b675b4f9660589 /tests/plugins/websockets | |
parent | 8fdf05d4f360a9f6344141b273eab9d6859470e0 (diff) |
- Switch to the new goridge v3.1 which supports PROTOBUF
Signed-off-by: Valery Piashchynski <[email protected]>
Diffstat (limited to 'tests/plugins/websockets')
-rw-r--r-- | tests/plugins/websockets/websocket_plugin_test.go | 34 |
1 files changed, 10 insertions, 24 deletions
diff --git a/tests/plugins/websockets/websocket_plugin_test.go b/tests/plugins/websockets/websocket_plugin_test.go index 4e4c09f1..c1fd5f3e 100644 --- a/tests/plugins/websockets/websocket_plugin_test.go +++ b/tests/plugins/websockets/websocket_plugin_test.go @@ -28,20 +28,6 @@ import ( "github.com/stretchr/testify/assert" ) -type Msg struct { - // Topic makeMessage been pushed into. - Topics []string `json:"topic"` - - // Command (join, leave, headers) - Command string `json:"command"` - - // Broker (redis, memory) - Broker string `json:"broker"` - - // Payload to be broadcasted - Payload []byte `json:"payload"` -} - func TestBroadcastInit(t *testing.T) { cont, err := endure.NewContainer(nil, endure.SetLogLevel(endure.ErrorLevel)) assert.NoError(t, err) @@ -819,8 +805,8 @@ func publish(command string, broker string, topics ...string) { client := rpc.NewClientWithCodec(goridgeRpc.NewClientCodec(conn)) - var ret bool - err = client.Call("websockets.Publish", makeMessage(command, broker, []byte("hello, PHP"), topics...), &ret) + ret := &websocketsv1.Response{} + err = client.Call("websockets.Publish", makeMessage(command, broker, []byte("hello, PHP"), topics...), ret) if err != nil { panic(err) } @@ -834,8 +820,8 @@ func publishAsync(command string, broker string, topics ...string) { client := rpc.NewClientWithCodec(goridgeRpc.NewClientCodec(conn)) - var ret bool - err = client.Call("websockets.PublishAsync", makeMessage(command, broker, []byte("hello, PHP"), topics...), &ret) + ret := &websocketsv1.Response{} + err = client.Call("websockets.PublishAsync", makeMessage(command, broker, []byte("hello, PHP"), topics...), ret) if err != nil { panic(err) } @@ -849,8 +835,8 @@ func publishAsync2(command string, broker string, topics ...string) { client := rpc.NewClientWithCodec(goridgeRpc.NewClientCodec(conn)) - var ret bool - err = client.Call("websockets.PublishAsync", makeMessage(command, broker, []byte("hello, PHP2"), topics...), &ret) + ret := &websocketsv1.Response{} + err = client.Call("websockets.PublishAsync", makeMessage(command, broker, []byte("hello, PHP2"), topics...), ret) if err != nil { panic(err) } @@ -864,8 +850,8 @@ func publish2(command string, broker string, topics ...string) { client := rpc.NewClientWithCodec(goridgeRpc.NewClientCodec(conn)) - var ret bool - err = client.Call("websockets.Publish", makeMessage(command, broker, []byte("hello, PHP2"), topics...), &ret) + ret := &websocketsv1.Response{} + err = client.Call("websockets.Publish", makeMessage(command, broker, []byte("hello, PHP2"), topics...), ret) if err != nil { panic(err) } @@ -879,8 +865,8 @@ func messageWS(command string, broker string, payload []byte, topics ...string) } } -func makeMessage(command string, broker string, payload []byte, topics ...string) *websocketsv1.Messages { - m := &websocketsv1.Messages{ +func makeMessage(command string, broker string, payload []byte, topics ...string) *websocketsv1.Request { + m := &websocketsv1.Request{ Messages: []*websocketsv1.Message{ { Topics: topics, |