package pubsub type PubSub interface { Publish([]byte) Recv() chan Message } type Message struct { Topic string Msg []byte } const ( Topic_Camera = "camera" //摄像机消息 Topic_Task = "task" //任务消息 Topic_Sdk = "sdk" //算法消息 Topic_Event = "event" //事件消息 ) func NewPublisher(url string,mode int) (PubSub,error) { return newPub(url) } func NewSubscriber(url string,mode int,topics []string) (PubSub,error) { return newSub(url, topics) }