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.
 
 
 
 

30 line
1021 B

  1. // Licensed to the .NET Foundation under one or more agreements.
  2. // The .NET Foundation licenses this file to you under the MIT license.
  3. // See the LICENSE file in the project root for more information.
  4. using Microsoft.AspNetCore.Http;
  5. using Microsoft.AspNetCore.Http.Connections;
  6. #if NETCOREAPP3_1
  7. using System;
  8. #endif
  9. namespace MQTTnet.AspNetCore
  10. {
  11. public static class ConnectionRouteBuilderExtensions
  12. {
  13. #if NETCOREAPP3_1
  14. [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(...).")]
  15. #endif
  16. #if NETCOREAPP3_1 || NETCOREAPP2_1 || NETSTANDARD
  17. public static void MapMqtt(this ConnectionsRouteBuilder connection, PathString path)
  18. {
  19. connection.MapConnectionHandler<MqttConnectionHandler>(path, options =>
  20. {
  21. options.WebSockets.SubProtocolSelector = MqttSubProtocolSelector.SelectSubProtocol;
  22. });
  23. }
  24. #endif
  25. }
  26. }