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
My project uses MQTTnet AspNetCore encountered an exception after upgrading to version 4.3.2.930, but there is no problem using version 4.3.1.873 for the same code.
`using MQTTnet.Server;
using MQTTnet.AspNetCore;
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddConnections();
builder.Services.AddMqttServer(configure =>
{
configure.WithKeepAlive();
configure.WithDefaultEndpoint();
});
builder.Services.AddMqttTcpServerAdapter();
builder.Services.AddMqttWebSocketServerAdapter();
var app = builder.Build();
My project uses MQTTnet AspNetCore encountered an exception after upgrading to version 4.3.2.930, but there is no problem using version 4.3.1.873 for the same code.
`using MQTTnet.Server;
using MQTTnet.AspNetCore;
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddConnections();
builder.Services.AddMqttServer(configure =>
{
configure.WithKeepAlive();
configure.WithDefaultEndpoint();
});
builder.Services.AddMqttTcpServerAdapter();
builder.Services.AddMqttWebSocketServerAdapter();
var app = builder.Build();
app.UseRouting();
app.UseEndpoints(endpoints => endpoints.MapMqtt("/mqtt"));
app.UseMqttServer(configure =>
{
configure.ValidatingConnectionAsync += Configure_ValidatingConnectionAsync;
});
app.Run();
Task Configure_ValidatingConnectionAsync(ValidatingConnectionEventArgs arg)
{
if (string.IsNullOrWhiteSpace(arg.ClientId))
{
arg.ReasonCode = MQTTnet.Protocol.MqttConnectReasonCode.ClientIdentifierNotValid;
return Task.CompletedTask;
}
if (string.IsNullOrWhiteSpace(arg.UserName) || arg.Password != "testPassword")
{
arg.ReasonCode = MQTTnet.Protocol.MqttConnectReasonCode.BadUserNameOrPassword;
}
return Task.CompletedTask;
}`
The text was updated successfully, but these errors were encountered: