Merge pull request #882 from xljiulang/master

Use IConnectionEndPointFeature to get IMqttChannelAdapter.Endpoint in aspnetcore31
This commit is contained in:
Christian
2020-04-18 13:49:45 +02:00
committed by GitHub
4 changed files with 113 additions and 6 deletions
@@ -25,7 +25,7 @@ namespace MQTTnet.AspNetCore
_input = Connection.Transport.Input;
_output = Connection.Transport.Output;
}
_reader = new SpanBasedMqttPacketBodyReader();
}
@@ -37,6 +37,12 @@ namespace MQTTnet.AspNetCore
{
get
{
#if NETCOREAPP3_1
if (Connection?.RemoteEndPoint != null)
{
return Connection.RemoteEndPoint.ToString();
}
#endif
var connection = Http?.HttpContext?.Connection;
if (connection == null)
{