liuxiaolong
2020-01-14 f51eaaedb99d04d20500e3c7166b122940f2508d
fix test
1个文件已修改
12 ■■■■■ 已修改文件
pubsub_test.go 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
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)