MQTTnet.Exceptions.MqttProtocolViolationException: Received packet 'PubAck: [PacketIdentifier=21584] [ReasonCode=]' at an unexpected time.
See original GitHub issueDescribe the bug
A clear and concise description of what the bug is.
Which project is your bug related to?
- [ √] ManagedClient
To Reproduce
An error occurred while connecting to the mqtt service。 This problem exists with the latest version or 2.8.5 Using TCP This error occurs when the program is running on Windows 7 sp1, but it is normal in Windows 10.
Additional context / logging
MQTTnet.Exceptions.MqttProtocolViolationException: Received packet ‘PubAck: [PacketIdentifier=21584] [ReasonCode=]’ at an unexpected time.
Code example
var options = new ManagedMqttClientOptionsBuilder()
.WithAutoReconnectDelay(TimeSpan.FromSeconds(5))
.WithClientOptions(new MqttClientOptionsBuilder()
.WithClientId(Guid.NewGuid().ToString())
.WithTcpServer("127.0.0.1", 33382)
.WithCredentials(brokerInfo.BrokerUser, brokerInfo.BrokerPassword)
.WithCleanSession()
.Build())
.Build();
var mqttClient = new MqttFactory().CreateManagedMqttClient();
mqttClient.StartAsync(options);
mqttClient.ConnectingFailedHandler = new FailedHandler();
mqttClient.ConnectedHandler = new ConnectedHandler(lblWsState);
Issue Analytics
- State:
- Created 4 years ago
- Comments:16 (3 by maintainers)
Top Results From Across the Web
Received packet 'PubAck: [PacketIdentifier=21584] ...
This error occurs when the program is running on Windows 7 sp1, but it is normal in Windows 10. Additional context / logging....
Read more >MQTTnet
MQTTnet.Exceptions.MqttProtocolViolationException: Received packet 'PubAck: [PacketIdentifier=21584] [ReasonCode=]' at an unexpected time. $ 0.
Read more >MQTT 5.0 Message delivery retry and reason code
In MQTT 5.0 specification, it states that 'If PUBACK or PUBREC is received containing a Reason Code of 0x80 or greater the corresponding...
Read more >MQTT Reason Code Introduction and Quick Reference - EMQ
Reason Code Name Packets
0x00 Normal disconnection DISCONNECT
0x00 Granted QoS 0 SUBACK
0x01 Granted QoS 1 SUBACK
Read more >MQTT - AWS IoT Core
When the device reconnects to a persistent session, the session resumes, subscriptions are reinstated, and unacknowledged subscribed messages received and ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I will add some checks that a PUBREC from a previous connection will no longer throw this exception. I will check if a PUBREL can be sent indicating that the client doesn’t know the message anymore.
@Doyle-net Does this mean you fixed this issue and if yes how?