summaryrefslogtreecommitdiff
path: root/tests/plugins/websockets/websocket_plugin_test.go
diff options
context:
space:
mode:
authorValery Piashchynski <[email protected]>2021-06-09 20:26:18 +0300
committerGitHub <[email protected]>2021-06-09 20:26:18 +0300
commitb99bfbe21a0f44b1a16b9110d779719fc637127c (patch)
tree3aabdb96c86a59325d816ad64cabc967ef2c8f10 /tests/plugins/websockets/websocket_plugin_test.go
parent8fdf05d4f360a9f6344141b273eab9d6859470e0 (diff)
parent7665167623147403d575b7e2cf125073cbe6584d (diff)
#715 feat(protocol): use protobuf for the `kv` and `websockets` RPC callsv2.3.0-beta.3
#715 feat(protocol): use protobuf for the `kv` and `websockets` RPC calls
Diffstat (limited to 'tests/plugins/websockets/websocket_plugin_test.go')
-rw-r--r--tests/plugins/websockets/websocket_plugin_test.go34
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,