You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

24 lines
774 B

  1. using Microsoft.AspNetCore.Http;
  2. using Microsoft.AspNetCore.Http.Connections;
  3. #if NETCOREAPP3_1
  4. using System;
  5. #endif
  6. namespace MQTTnet.AspNetCore.Extensions
  7. {
  8. public static class ConnectionRouteBuilderExtensions
  9. {
  10. #if NETCOREAPP3_1
  11. [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(...).")]
  12. #endif
  13. public static void MapMqtt(this ConnectionsRouteBuilder connection, PathString path)
  14. {
  15. connection.MapConnectionHandler<MqttConnectionHandler>(path, options =>
  16. {
  17. options.WebSockets.SubProtocolSelector = MqttSubProtocolSelector.SelectSubProtocol;
  18. });
  19. }
  20. }
  21. }