You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello,
talking about the "simple" client, not the managed one, it does seem that the persistent session is not working with V5 protocol.
Here's the behavior (tested with multiple brokers to make sure it wasn't a broker issue):
connect with V5 protocol, clean session set to false, clientId "my-persistent-clientid".
subscribe a topic "topicTest/01", with qos 1 or 2.
disconnect
with another clientid, publish something on "topicTest/01" with qos 1 or 2.
reconnect with the same settings of point 1: V5 protocol, clean session set to false, clientId "my-persistent-clientid"
nothing is received
If I'm doing the same with V311 protocol, everything is working fine.
Here's the code for the subscriber:
`
var options = new MqttClientOptionsBuilder()
.WithProtocolVersion(MqttProtocolVersion.V500)
.WithClientId("my-persistent-clientid")
.WithTcpServer("myhost", 8883) // Adjust broker host
.WithCredentials("myusername", "mypwd") // Adjust username and password
.WithCleanSession(false)
.WithTlsOptions(
new MqttClientTlsOptions
{
UseTls = clientSettings.UseTls,
IgnoreCertificateChainErrors = true,
IgnoreCertificateRevocationErrors = true,
AllowUntrustedCertificates = true,
CertificateValidationHandler = delegate { return true; }
}
)
.Build();
var mqttFactory = new MqttFactory();
using var mqttClient = mqttFactory.CreateMqttClient();
Task local_ApplicationMessageReceivedAsync(MqttApplicationMessageReceivedEventArgs arg)
{
Console.WriteLine($"Client id {arg.ClientId}, topic {arg.ApplicationMessage.Topic}, message received {arg.ApplicationMessage.ConvertPayloadToString()}");
return Task.CompletedTask;
}
mqttClient.ApplicationMessageReceivedAsync += local_ApplicationMessageReceivedAsync;
mqttClient.ConnectAsync(options).Wait();
mqttClient.SubscribeAsync(topic: "topicTest/01", qualityOfServiceLevel: MqttQualityOfServiceLevel.ExactlyOnce).Wait();
Console.WriteLine("Press any key to exit.");
Console.ReadLine();
mqttClient.DisconnectAsync().Wait();
`
The text was updated successfully, but these errors were encountered:
Hello,
talking about the "simple" client, not the managed one, it does seem that the persistent session is not working with V5 protocol.
Here's the behavior (tested with multiple brokers to make sure it wasn't a broker issue):
If I'm doing the same with V311 protocol, everything is working fine.
Here's the code for the subscriber:
`
`
The text was updated successfully, but these errors were encountered: