瀏覽代碼

merged if statements

release/3.x.x
JanEggers 7 年之前
父節點
當前提交
c775867db4
共有 1 個檔案被更改,包括 5 行新增8 行删除
  1. +5
    -8
      Frameworks/MQTTnet.AspnetCore/ApplicationBuilderExtensions.cs

+ 5
- 8
Frameworks/MQTTnet.AspnetCore/ApplicationBuilderExtensions.cs 查看文件

@@ -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…
取消
儲存