Exemplo n.º 1
0
    public bool TryParseMessage(ref ReadOnlySequence <byte> input, IInvocationBinder binder, [NotNullWhen(true)] out HubMessage?message)
    {
        if (!BinaryMessageParser.TryParseMessage(ref input, out var payload))
        {
            message = null;
            return(false);
        }

        var reader = new MessagePackReader(payload);

        message = ParseMessage(ref reader, binder);
        return(message != null);
    }
Exemplo n.º 2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SerializedHubMessage"/> class.
 /// </summary>
 /// <param name="message">The hub message for the cache. This will be serialized with an <see cref="IHubProtocol"/> in <see cref="GetSerializedMessage"/> to get the message's serialized representation.</param>
 public SerializedHubMessage(HubMessage message)
 {
     Message = message;
 }
Exemplo n.º 3
0
 /// <inheritdoc />
 public bool TryParseMessage(ref ReadOnlySequence <byte> input, IInvocationBinder binder, [NotNullWhen(true)] out HubMessage?message)
 => _worker.TryParseMessage(ref input, binder, out message);
Exemplo n.º 4
0
    /// <inheritdoc />
    public bool TryParseMessage(ref ReadOnlySequence <byte> input, IInvocationBinder binder, [NotNullWhen(true)] out HubMessage?message)
    {
        if (!TextMessageParser.TryParseMessage(ref input, out var payload))
        {
            message = null;
            return(false);
        }

        var textReader = Utf8BufferTextReader.Get(payload);

        try
        {
            message = ParseMessage(textReader, binder);
        }
        finally
        {
            Utf8BufferTextReader.Return(textReader);
        }

        return(message != null);
    }