SignalR stream data to a specified client? [Answered]

Is there a way to stream data to a specified client?
public async Task TransferFileAsync(string connectionId, IAsyncEnumerable<byte[]> bytes, CancellationToken cancellationToken)
{
await foreach (var buffer in bytes)
{
cancellationToken.ThrowIfCancellationRequested();
await Clients.Client(connectionId).SendAsync("ReceiveFile", buffer, cancellationToken);
}
}
public async Task TransferFileAsync(string connectionId, IAsyncEnumerable<byte[]> bytes, CancellationToken cancellationToken)
{
await foreach (var buffer in bytes)
{
cancellationToken.ThrowIfCancellationRequested();
await Clients.Client(connectionId).SendAsync("ReceiveFile", buffer, cancellationToken);
}
}
would this work?
1 Reply
Accord
Accord2y ago
✅ This post has been marked as answered!