30 lines
800 B
C#
30 lines
800 B
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Security.AccessControl;
|
|
using System.Threading.Tasks;
|
|
using Microsoft.AspNetCore.SignalR;
|
|
using Microsoft.Extensions.Logging;
|
|
using NLog;
|
|
|
|
namespace Squirrowse.Service.Hubs
|
|
{
|
|
public class StreamHub : Hub, IStreamHub
|
|
{
|
|
private readonly ILogger<StreamHub> logger;
|
|
|
|
public StreamHub(ILogger<StreamHub> logger)
|
|
{
|
|
this.logger = logger;
|
|
}
|
|
public async Task UploadByteStream(IAsyncEnumerable<byte[]> stream)
|
|
{
|
|
await foreach (var frame in stream)
|
|
{
|
|
logger.LogInformation($"Got frame size: {frame.Length} ");
|
|
await Task.Delay(100); //leave some delay for debug purpose
|
|
}
|
|
}
|
|
}
|
|
}
|