public byte InvocationMessage() { //Allocation on purpore here for test var protobufInvocationMessage = new InvocationMessageProtobuf(); var packedInvocationMessage = MessageDescriptor.PackMessage(HubProtocolConstants.InvocationMessageType, protobufInvocationMessage.ToByteArray(), GetArgumentsDescriptors(N)); return(MessageDescriptor.GetMessageType(packedInvocationMessage)); }
private HubMessage CreateHubInvocationMessage(ReadOnlySpan <byte> protobufMessage, object[] arguments) { var protobufInvocationMessage = new InvocationMessageProtobuf(); protobufInvocationMessage.MergeFrom(protobufMessage.ToArray()); return(new InvocationMessage(protobufInvocationMessage.InvocationId, protobufInvocationMessage.Target, arguments, protobufInvocationMessage.StreamIds.ToArray()) { Headers = protobufInvocationMessage.Headers }); }
private void WriteInvocationMessage(InvocationMessage invocationMessage, IBufferWriter <byte> output) { var protobufInvocationMessage = new InvocationMessageProtobuf { InvocationId = invocationMessage.InvocationId ?? "", Target = invocationMessage.Target }; if (invocationMessage.Headers != null) { protobufInvocationMessage.Headers.Add(invocationMessage.Headers); } if (invocationMessage.StreamIds != null) { protobufInvocationMessage.StreamIds.Add(invocationMessage.StreamIds.Select(id => id ?? "")); } var arguments = _argumentSerializer.SerializeArguments(invocationMessage.Arguments); var packedMessage = MessageDescriptor.PackMessage(HubProtocolConstants.InvocationMessageType, protobufInvocationMessage.ToByteArray(), arguments); output.Write(packedMessage); }