mirror of
https://github.com/dotnet/MQTTnet.git
synced 2026-10-15 00:15:15 +08:00
merged if statements
This commit is contained in:
@@ -17,15 +17,12 @@ namespace MQTTnet.AspNetCore
|
||||
{
|
||||
string subprotocol = null;
|
||||
|
||||
if (context.Request.Headers.TryGetValue("Sec-WebSocket-Protocol", out var requestedSubProtocolValues))
|
||||
if (context.Request.Headers.TryGetValue("Sec-WebSocket-Protocol", out var requestedSubProtocolValues)
|
||||
&& requestedSubProtocolValues.Count > 0
|
||||
&& requestedSubProtocolValues.Any(v => v.ToLower() == "mqtt")
|
||||
)
|
||||
{
|
||||
if (requestedSubProtocolValues.Count > 0)
|
||||
{
|
||||
if (requestedSubProtocolValues.Any(v => v.ToLower() == "mqtt"))
|
||||
{
|
||||
subprotocol = "mqtt";
|
||||
}
|
||||
}
|
||||
subprotocol = "mqtt";
|
||||
}
|
||||
|
||||
var adapter = app.ApplicationServices.GetRequiredService<MqttWebSocketServerAdapter>();
|
||||
|
||||
Reference in New Issue
Block a user