Esempio n. 1
0
 private void WriteCloseMessage(CloseMessage message, Utf8JsonWriter writer)
 {
     if (message.Error != null)
     {
         writer.WriteString(ErrorPropertyNameBytes, message.Error);
     }
 }
Esempio n. 2
0
 private void WriteCloseMessage(CloseMessage message, JsonTextWriter writer)
 {
     if (message.Error != null)
     {
         writer.WritePropertyName(ErrorPropertyName);
         writer.WriteValue(message.Error);
     }
 }
Esempio n. 3
0
        private CloseMessage BindCloseMessage(string error)
        {
            // An empty string is still an error
            if (error == null)
            {
                return(CloseMessage.Empty);
            }

            var message = new CloseMessage(error);

            return(message);
        }
Esempio n. 4
0
        private void WriteCloseMessage(CloseMessage message, Utf8JsonWriter writer)
        {
            if (message.Error != null)
            {
                writer.WriteString(ErrorPropertyNameBytes, message.Error);
            }

            if (message.AllowReconnect)
            {
                writer.WriteBoolean(AllowReconnectPropertyNameBytes, true);
            }
        }
        private void WriteCloseMessage(CloseMessage message, JsonTextWriter writer)
        {
            if (message.Error != null)
            {
                writer.WritePropertyName(ErrorPropertyName);
                writer.WriteValue(message.Error);
            }

            if (message.AllowReconnect)
            {
                writer.WritePropertyName(AllowReconnectPropertyName);
                writer.WriteValue(true);
            }
        }
        private static void WriteCloseMessage(CloseMessage message, ref MessagePackWriter writer)
        {
            writer.WriteArrayHeader(3);
            writer.Write(HubProtocolConstants.CloseMessageType);
            if (string.IsNullOrEmpty(message.Error))
            {
                writer.WriteNil();
            }
            else
            {
                writer.Write(message.Error);
            }

            writer.Write(message.AllowReconnect);
        }