From f51eaaedb99d04d20500e3c7166b122940f2508d Mon Sep 17 00:00:00 2001 From: liuxiaolong <736321739@qq.com> Date: 星期二, 14 一月 2020 20:56:01 +0800 Subject: [PATCH] fix test --- pubsub_test.go | 12 +++++------- 1 files changed, 5 insertions(+), 7 deletions(-) diff --git a/pubsub_test.go b/pubsub_test.go index c45c9f8..7604679 100644 --- a/pubsub_test.go +++ b/pubsub_test.go @@ -1,14 +1,13 @@ package pubsub import ( - "encoding/json" "fmt" "testing" "time" ) func startServer(url string) { - pub, err := NewPublisher(url,1) + pub, err := NewPublisher(url,"tcp://127.0.0.1:5005",1) if err !=nil { fmt.Println("NEW PUB ERR:",err) } @@ -19,15 +18,14 @@ Topic: Topic_Task, Msg: []byte("tttt"), } - b1, _ := json.Marshal(m1) - pub.Publish(b1) + + pub.Publish(m1) var m2 = Message{ Topic: Topic_Camera, Msg: []byte("5.34"), } - b2, _ := json.Marshal(m2) - pub.Publish(b2) + pub.Publish(m2) } }() } @@ -36,7 +34,7 @@ url := "tcp://0.0.0.0:4005" startServer(url) - sub, err := NewSubscriber(url,1,[]string{ Topic_Camera }) + sub, err := NewSubscriber(url,"tcp://127.0.0.1:5005",1,[]string{ Topic_Camera },"proc") if err !=nil { fmt.Println("NEW SUB ERR:",err) -- Gitblit v1.8.0