diff --git a/src/Microsoft.Azure.SignalR.Protocols/ServiceMessage.cs b/src/Microsoft.Azure.SignalR.Protocols/ServiceMessage.cs
index 6e18e9f4b..a2319142e 100644
--- a/src/Microsoft.Azure.SignalR.Protocols/ServiceMessage.cs
+++ b/src/Microsoft.Azure.SignalR.Protocols/ServiceMessage.cs
@@ -290,6 +290,11 @@ public class HandshakeRequestMessage : ExtensibleServiceMessage
///
public int MigrationLevel { get; set; }
+ ///
+ /// Gets or sets the allowing of client stateful reconnects.
+ ///
+ public bool AllowStatefulReconnects { get; set; }
+
///
/// Initializes a new instance of the class.
///
diff --git a/src/Microsoft.Azure.SignalR.Protocols/ServiceProtocol.cs b/src/Microsoft.Azure.SignalR.Protocols/ServiceProtocol.cs
index bf4a85bee..bd8012984 100644
--- a/src/Microsoft.Azure.SignalR.Protocols/ServiceProtocol.cs
+++ b/src/Microsoft.Azure.SignalR.Protocols/ServiceProtocol.cs
@@ -313,13 +313,14 @@ private static void WriteMessageCore(ref MessagePackWriter writer, ServiceMessag
private static void WriteHandshakeRequestMessage(ref MessagePackWriter writer, HandshakeRequestMessage message)
{
- writer.WriteArrayHeader(6);
+ writer.WriteArrayHeader(7);
writer.Write(ServiceProtocolConstants.HandshakeRequestType);
writer.Write(message.Version);
writer.Write(message.ConnectionType);
writer.Write(message.ConnectionType == 0 ? "" : message.Target ?? string.Empty);
- writer.Write((int)message.MigrationLevel);
+ writer.Write(message.MigrationLevel);
message.WriteExtensionMembers(ref writer);
+ writer.Write(message.AllowStatefulReconnects);
}
private static void WriteHandshakeResponseMessage(ref MessagePackWriter writer, HandshakeResponseMessage message)
@@ -800,6 +801,10 @@ private static HandshakeRequestMessage CreateHandshakeRequestMessage(ref Message
{
result.ReadExtensionMembers(ref reader);
}
+ if (arrayLength >= 7)
+ {
+ result.AllowStatefulReconnects = ReadBoolean(ref reader, "enableStatefulReconnects");
+ }
return result;
}
diff --git a/test/Microsoft.Azure.SignalR.Protocols.Tests/ServiceMessageEqualityComparer.cs b/test/Microsoft.Azure.SignalR.Protocols.Tests/ServiceMessageEqualityComparer.cs
index b916185f8..ec87b5b86 100644
--- a/test/Microsoft.Azure.SignalR.Protocols.Tests/ServiceMessageEqualityComparer.cs
+++ b/test/Microsoft.Azure.SignalR.Protocols.Tests/ServiceMessageEqualityComparer.cs
@@ -115,7 +115,11 @@ public int GetHashCode(ServiceMessage obj)
private bool HandshakeRequestMessagesEqual(HandshakeRequestMessage x, HandshakeRequestMessage y)
{
- return x.Version == y.Version;
+ return x.Version == y.Version &&
+ x.AllowStatefulReconnects == y.AllowStatefulReconnects &&
+ x.MigrationLevel == y.MigrationLevel &&
+ (x.Target ?? string.Empty) == (y.Target ?? string.Empty) &&
+ x.ConnectionType == y.ConnectionType;
}
private bool HandshakeResponseMessagesEqual(HandshakeResponseMessage x, HandshakeResponseMessage y)
diff --git a/test/Microsoft.Azure.SignalR.Protocols.Tests/ServiceProtocolFacts.cs b/test/Microsoft.Azure.SignalR.Protocols.Tests/ServiceProtocolFacts.cs
index a37c0bb59..7df83654b 100644
--- a/test/Microsoft.Azure.SignalR.Protocols.Tests/ServiceProtocolFacts.cs
+++ b/test/Microsoft.Azure.SignalR.Protocols.Tests/ServiceProtocolFacts.cs
@@ -86,6 +86,18 @@ public static IEnumerable