Squirrowse/Squirrowse.Service/Hubs/StreamHub.cs

30 lines
800 B
C#
Raw Normal View History

2019-10-31 12:53:57 +01:00
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
}
}
}
}