mirror of
https://github.com/dotnet/MQTTnet.git
synced 2026-10-25 23:53:07 +08:00
merged if statements
This commit is contained in:
@@ -17,15 +17,12 @@ namespace MQTTnet.AspNetCore
|
|||||||
{
|
{
|
||||||
string subprotocol = null;
|
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)
|
subprotocol = "mqtt";
|
||||||
{
|
|
||||||
if (requestedSubProtocolValues.Any(v => v.ToLower() == "mqtt"))
|
|
||||||
{
|
|
||||||
subprotocol = "mqtt";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var adapter = app.ApplicationServices.GetRequiredService<MqttWebSocketServerAdapter>();
|
var adapter = app.ApplicationServices.GetRequiredService<MqttWebSocketServerAdapter>();
|
||||||
|
|||||||
Reference in New Issue
Block a user