mirror of
https://github.com/dotnet/MQTTnet.git
synced 2026-10-25 07:41:32 +08:00
Use IConnectionEndPointFeature to get IMqttChannelAdapter.Endpoint in aspnetcore31
This commit is contained in:
@@ -37,6 +37,13 @@ namespace MQTTnet.AspNetCore
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
|
#if NETCOREAPP3_1
|
||||||
|
var endpointFeature = Connection.Features.Get<Microsoft.AspNetCore.Connections.Features.IConnectionEndPointFeature>();
|
||||||
|
if (endpointFeature != null)
|
||||||
|
{
|
||||||
|
return endpointFeature.RemoteEndPoint.ToString();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
var connection = Http?.HttpContext?.Connection;
|
var connection = Http?.HttpContext?.Connection;
|
||||||
if (connection == null)
|
if (connection == null)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user