|
@@ -34,6 +34,7 @@ type Connection struct {
|
|
|
KeepAlive uint16
|
|
|
LastHbTime int64
|
|
|
Token []byte
|
|
|
+ VendorId string
|
|
|
}
|
|
|
|
|
|
// NewConnection create a connection
|
|
@@ -177,6 +178,7 @@ func (c *Connection) RcvMsgFromClient() {
|
|
|
return
|
|
|
}
|
|
|
c.DeviceID = device.RecordId
|
|
|
+ c.VendorId = device.VendorID
|
|
|
token, err := hex.DecodeString(msg.Password)
|
|
|
if err != nil {
|
|
|
server.Log.Warn("token format error : %v", err)
|
|
@@ -223,7 +225,7 @@ func (c *Connection) RcvMsgFromClient() {
|
|
|
|
|
|
case *Publish:
|
|
|
server.Log.Infof("%s, publish topic: %s", host, msg.TopicName)
|
|
|
- _ = c.Mgr.PublishMessage2Server(c.DeviceID, msg)
|
|
|
+ _ = c.Mgr.PublishMessage2Server(c.DeviceID, c.VendorId, msg)
|
|
|
if msg.QosLevel.IsAtLeastOnce() {
|
|
|
server.Log.Infof("publish ack send now")
|
|
|
publishack := &PubAck{MessageID: msg.MessageID}
|