mirror of
https://github.com/dotnet/MQTTnet.git
synced 2026-10-16 01:03:01 +08:00
22 lines
524 B
C#
22 lines
524 B
C#
|
|
#if NETCOREAPP3_1
|
|
|
|
using Microsoft.AspNetCore.Builder;
|
|
using Microsoft.AspNetCore.Routing;
|
|
|
|
namespace MQTTnet.AspNetCore
|
|
{
|
|
public static class EndpointRouterExtensions
|
|
{
|
|
public static void MapMqtt(this IEndpointRouteBuilder endpoints, string pattern)
|
|
{
|
|
endpoints.MapConnectionHandler<MqttConnectionHandler>(pattern, options =>
|
|
{
|
|
options.WebSockets.SubProtocolSelector = MqttSubProtocolSelector.SelectSubProtocol;
|
|
});
|
|
}
|
|
}
|
|
}
|
|
|
|
#endif
|