예제 #1
0
        /// <inheritdoc />
        /// <exception cref="ObjectDisposedException">This instance has already been disposed.</exception>
        public override async Task SendAsync(Envelope envelope, CancellationToken cancellationToken)
        {
            ThrowIfNotConnected();

            await base.SendAsync(envelope, cancellationToken).ConfigureAwait(false);

            string serializedEnvelope = EnvelopeSerializer.Serialize(envelope);
            await TraceWriter.TraceIfEnabledAsync(serializedEnvelope, DataOperation.Send).ConfigureAwait(false);

            await _hubConnection.SendAsync(FROM_CLIENT_METHOD, serializedEnvelope, cancellationToken).ConfigureAwait(false);
        }
예제 #2
0
        /// <inheritdoc />
        /// <exception cref="InvalidOperationException">Thrown when the transport is not connected.</exception>
        public override async Task SendAsync(Envelope envelope, CancellationToken cancellationToken)
        {
            ThrowIfNotConnected();

            await base.SendAsync(envelope, cancellationToken).ConfigureAwait(false);

            string serializedEnvelope = EnvelopeSerializer.Serialize(envelope);
            await TraceWriter.TraceIfEnabledAsync(serializedEnvelope, DataOperation.Send).ConfigureAwait(false);

            var client = _hubContext.Clients.Client(_connectionId);

            await client.SendAsync(FROM_SERVER_METHOD, serializedEnvelope).ConfigureAwait(false);
        }