Browse Source

merged if statements

release/3.x.x
JanEggers 7 years ago
parent
commit
c775867db4
1 changed files with 5 additions and 8 deletions
  1. +5
    -8
      Frameworks/MQTTnet.AspnetCore/ApplicationBuilderExtensions.cs

+ 5
- 8
Frameworks/MQTTnet.AspnetCore/ApplicationBuilderExtensions.cs View File

@@ -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>();


Loading…
Cancel
Save