Ejemplo n.º 1
0
        public PostgreSqlInvocation ReadInvocation(ReadOnlyMemory <byte> data)
        {
            // See WriteInvocation for the format
            ValidateArraySize(ref data, 2, "Invocation");

            // Read excluded Ids
            IReadOnlyList <string> excludedConnectionIds = null;
            var idCount = MessagePackUtil.ReadArrayHeader(ref data);

            if (idCount > 0)
            {
                var ids = new string[idCount];
                for (var i = 0; i < idCount; i++)
                {
                    ids[i] = MessagePackUtil.ReadString(ref data);
                }

                excludedConnectionIds = ids;
            }

            // Read payload
            var message = ReadSerializedHubMessage(ref data);

            return(new PostgreSqlInvocation(message, excludedConnectionIds));
        }
Ejemplo n.º 2
0
        public static SerializedHubMessage ReadSerializedHubMessage(ref ReadOnlyMemory <byte> data)
        {
            var count          = MessagePackUtil.ReadMapHeader(ref data);
            var serializations = new SerializedMessage[count];

            for (var i = 0; i < count; i++)
            {
                var protocol   = MessagePackUtil.ReadString(ref data);
                var serialized = MessagePackUtil.ReadBytes(ref data);
                serializations[i] = new SerializedMessage(protocol, serialized);
            }

            return(new SerializedHubMessage(serializations));
        }