示例#1
0
        private static void WriteOpenConnectionMessage(ref MessagePackWriter writer, OpenConnectionMessage message)
        {
            writer.WriteArrayHeader(6);
            writer.Write(ServiceProtocolConstants.OpenConnectionMessageType);
            writer.Write(message.ConnectionId);

            if (message.Claims?.Length > 0)
            {
                writer.WriteMapHeader(message.Claims.Length);
                foreach (var claim in message.Claims)
                {
                    writer.Write(claim.Type);
                    writer.Write(claim.Value);
                }
            }
            else
            {
                writer.WriteMapHeader(0);
            }
            WriteHeaders(ref writer, message.Headers);

            writer.Write(message.QueryString);
            message.WriteExtensionMembers(ref writer);
        }