Skip to content

Commit 9160465

Browse files
committed
fix twin response
1 parent e0bfd4a commit 9160465

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

device/Microsoft.Azure.Devices.Client/Transport/Mqtt/MqttTransportHandler.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ namespace Microsoft.Azure.Devices.Client.Transport.Mqtt
2929
using Microsoft.Practices.EnterpriseLibrary.TransientFaultHandling;
3030
using Newtonsoft.Json;
3131
using TransportType = Microsoft.Azure.Devices.Client.TransportType;
32-
32+
using System.Web;
33+
3334
sealed class MqttTransportHandler : TransportHandler
3435
{
3536
const int ProtocolGatewayPort = 8883;
@@ -95,7 +96,7 @@ internal enum TransportState
9596
const string twinPatchTopic = "$iothub/twin/PATCH/properties/reported/?$rid={0}";
9697

9798
// incoming topic regexp
98-
const string twinResponseTopicPattern = @"\$iothub/twin/res/(\d+)/\?\$rid=(.+)";
99+
const string twinResponseTopicPattern = @"\$iothub/twin/res/(\d+)/(\?.+)";
99100
Regex twinResponseTopicRegex = new Regex(twinResponseTopicPattern, RegexOptions.None);
100101

101102
Func<MethodRequestInternal, Task> messageListener;
@@ -587,7 +588,7 @@ Boolean parseResponseTopic(string topicName, out string rid, out Int32 status)
587588
if (match.Success)
588589
{
589590
status = Convert.ToInt32(match.Groups[1].Value);
590-
rid = match.Groups[2].Value;
591+
rid = HttpUtility.ParseQueryString(match.Groups[2].Value).Get("$rid");
591592
return true;
592593
}
593594
else

0 commit comments

Comments
 (0)