Beispiel #1
0
        private void WriteStreamInvocationMessage(StreamInvocationMessage message, JsonTextWriter writer)
        {
            WriteInvocationId(message, writer);
            writer.WritePropertyName(TargetPropertyName);
            writer.WriteValue(message.Target);

            WriteArguments(message.Arguments, writer);
        }
 private void WriteStreamInvocationMessage(StreamInvocationMessage streamInvocationMessage, Packer packer)
 {
     packer.PackArrayHeader(4);
     packer.Pack(HubProtocolConstants.StreamInvocationMessageType);
     packer.PackString(streamInvocationMessage.InvocationId);
     packer.PackString(streamInvocationMessage.Target);
     packer.PackObject(streamInvocationMessage.Arguments, _serializationContext);
 }
 private void WriteStreamInvocationMessage(StreamInvocationMessage message, Packer packer)
 {
     packer.PackArrayHeader(5);
     packer.Pack(HubProtocolConstants.StreamInvocationMessageType);
     PackHeaders(packer, message.Headers);
     packer.PackString(message.InvocationId);
     packer.PackString(message.Target);
     packer.PackObject(message.Arguments, SerializationContext);
 }
Beispiel #4
0
        private void WriteStreamInvocationMessage(StreamInvocationMessage message, JsonTextWriter writer)
        {
            writer.WriteStartObject();
            WriteHubInvocationMessageCommon(message, writer, HubProtocolConstants.StreamInvocationMessageType);
            writer.WritePropertyName(TargetPropertyName);
            writer.WriteValue(message.Target);

            WriteArguments(message.Arguments, writer);

            writer.WriteEndObject();
        }
        private StreamInvocationMessage BindStreamInvocationMessage(JObject json, IInvocationBinder binder)
        {
            var invocationId = JsonUtils.GetRequiredProperty <string>(json, InvocationIdPropertyName, JTokenType.String);
            var target       = JsonUtils.GetRequiredProperty <string>(json, TargetPropertyName, JTokenType.String);

            var args = JsonUtils.GetRequiredProperty <JArray>(json, ArgumentsPropertyName, JTokenType.Array);

            var paramTypes = binder.GetParameterTypes(target);

            StreamInvocationMessage message;

            try
            {
                var arguments = BindArguments(args, paramTypes);
                message = new StreamInvocationMessage(invocationId, target, argumentBindingException: null, arguments: arguments);
            }
            catch (Exception ex)
            {
                message = new StreamInvocationMessage(invocationId, target, ExceptionDispatchInfo.Capture(ex));
            }
            ReadHeaders(json, message.Headers);
            return(message);
        }