ConnectionRouteBuilderExtensions.cs 737 B

1234567891011121314151617181920
  1. using Microsoft.AspNetCore.Http;
  2. using Microsoft.AspNetCore.Http.Connections;
  3. using System;
  4. namespace MQTTnet.AspNetCore
  5. {
  6. public static class ConnectionRouteBuilderExtensions
  7. {
  8. #if NETCOREAPP3_1
  9. [Obsolete("This class is obsolete and will be removed in a future version. The recommended alternative is to use MapMqtt inside Microsoft.AspNetCore.Builder.UseEndpoints(...).")]
  10. #endif
  11. public static void MapMqtt(this ConnectionsRouteBuilder connection, PathString path)
  12. {
  13. connection.MapConnectionHandler<MqttConnectionHandler>(path, options =>
  14. {
  15. options.WebSockets.SubProtocolSelector = MqttSubProtocolSelector.SelectSubProtocol;
  16. });
  17. }
  18. }
  19. }