Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

订阅主题#出错 #433

Open
cokll opened this issue Sep 24, 2024 · 5 comments
Open

订阅主题#出错 #433

cokll opened this issue Sep 24, 2024 · 5 comments

Comments

@cokll
Copy link

cokll commented Sep 24, 2024

相同的代码一个可以订阅#主题一个不能订阅 是为什么
还有如何修改全局消息过期时间为10s

time=2024-09-25T01:52:33.167+08:00 level=WARN msg="" listener=t1 error="protocol violation: topic contains wildcards" time=2024-09-25T01:52:35.637+08:00 level=WARN msg="error processing packet" erro r="protocol violation: topic contains wildcards" client=YK-ESP_9ef0 listener=t1 pk="{Connect:{WillProperties:{CorrelationData:[] SubscriptionIdentifier:[] Authe nticationData:[] User:[] ContentType: ResponseTopic: AssignedClientID: Authentic ationMethod: ResponseInfo: ServerReference: ReasonString: MessageExpiryInterval: 0 SessionExpiryInterval:0 WillDelayInterval:0 MaximumPacketSize:0 ServerKeepAliv e:0 ReceiveMaximum:0 TopicAliasMaximum:0 TopicAlias:0 PayloadFormat:0 PayloadFor matFlag:false SessionExpiryIntervalFlag:false ServerKeepAliveFlag:false RequestP roblemInfo:0 RequestProblemInfoFlag:false RequestResponseInfo:0 TopicAliasFlag:f alse MaximumQos:0 MaximumQosFlag:false RetainAvailable:0 RetainAvailableFlag:fal se WildcardSubAvailable:0 WildcardSubAvailableFlag:false SubIDAvailable:0 SubIDA vailableFlag:false SharedSubAvailable:0 SharedSubAvailableFlag:false} Password:[ ] Username:[] ProtocolName:[] WillPayload:[] ClientIdentifier: WillTopic: Keepal ive:0 PasswordFlag:false UsernameFlag:false WillQos:0 WillFlag:false WillRetain: false Clean:false} Properties:{CorrelationData:[] SubscriptionIdentifier:[] Auth enticationData:[] User:[] ContentType: ResponseTopic: AssignedClientID: Authenti cationMethod: ResponseInfo: ServerReference: ReasonString: MessageExpiryInterval :0 SessionExpiryInterval:0 WillDelayInterval:0 MaximumPacketSize:0 ServerKeepAli ve:0 ReceiveMaximum:0 TopicAliasMaximum:0 TopicAlias:0 PayloadFormat:0 PayloadFo rmatFlag:false SessionExpiryIntervalFlag:false ServerKeepAliveFlag:false Request ProblemInfo:0 RequestProblemInfoFlag:false RequestResponseInfo:0 TopicAliasFlag: false MaximumQos:0 MaximumQosFlag:false RetainAvailable:0 RetainAvailableFlag:fa lse WildcardSubAvailable:0 WildcardSubAvailableFlag:false SubIDAvailable:0 SubID AvailableFlag:false SharedSubAvailable:0 SharedSubAvailableFlag:false} Payload:[ 123 49 44 49 44 49 44 49 44 48 44 48 44 45 53 44 45 53 44 50 50 44 52 44 49 55 5 0 55 50 50 57 49 53 53 125] ReasonCodes:[] Filters:[] TopicName:car_wifi/# Origi n: FixedHeader:{Remaining:47 Type:3 Qos:0 Dup:false Retain:false} Created:0 Expi ry:0 Mods:{MaxSize:0 DisallowProblemInfo:false AllowResponseInfo:false} PacketID :0 ProtocolVersion:4 SessionPresent:false ReasonCode:0 ReservedBit:0 Ignore:fals e}"

代码没有做任何更改 大概报错2-3分钟后就可以成功订阅

@werbenhu
Copy link
Member

@cokll 能提供一下复现问题的简单的demo代码吗?

@cokll
Copy link
Author

cokll commented Nov 14, 2024

@werbenhu 客户端为esp32 库为AsyncMqttClient

订阅代码 mqtt_topic="car_wifi/#";

mqtt.log

@werbenhu
Copy link
Member

通配符 + #这种只能在订阅的topic里面用,你是不是在publish的时候也用了这个带了通配符的topic了

@cokll
Copy link
Author

cokll commented Nov 15, 2024

@werbenhu 就是订阅 订阅完了才可以 publish啊 都没订阅怎么publish
大概报错等个1-2分钟 错误就消失了 就可以正常用
还有如果每20毫秒发送一次数据 发送一晚上后
mqtt服务器就不会再响应 ,必须重启服务器才可以继续接收消息

@werbenhu
Copy link
Member

error="protocol violation: no topic or alias" client=YK-ESP_9ef0 listener=t1 ,我看你大部分这个错误,这个是publish的topic为空,还有一个protocol violation: topic contains wildcards,就是publish的topic有通配符。 其实这些错误码,代码里面都有的,意思是服务端收到的publish就有问题吗? 你这日志里面没有订阅的日志啊,全是PUBLISH的,你是不是搞错了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants