Пример #1
0
        private static void WriteConnectionDataMessage(ref MessagePackWriter writer, ConnectionDataMessage message)
        {
            writer.WriteArrayHeader(3);
            writer.Write(ServiceProtocolConstants.ConnectionDataMessageType);
            writer.Write(message.ConnectionId);

            /************ REVIEW ************/
            // REVIEW : PREVIOUS CODE WAS writing every bytes manualy, not sure if this is the strict equivalent in term of serialization
            writer.Write(message.Payload);
        }
Пример #2
0
        private static ConnectionDataMessage CreateConnectionDataMessage(ref MessagePackReader reader, int arrayLength)
        {
            var connectionId = ReadString(ref reader, "connectionId");
            var payload      = ReadBytes(ref reader, "payload");

            var result = new ConnectionDataMessage(connectionId, payload);

            if (arrayLength >= 4)
            {
                result.ReadExtensionMembers(ref reader);
            }
            return(result);
        }