0

I am working on the .NET framework 4.6.1. I want to stream data from the typescript client to my service. I have taken code from here. This is the service side code :

            public async Task UploadStream(ChannelReader<byte[]> stream)
        {
            while (await stream.WaitToReadAsync())
            {
                while (stream.TryRead(out var item))
                {
                    // do something with the stream item
                    Console.WriteLine(item);
                }
            }
        }

Client side:

const subject = new signalR.Subject();
await connection.send("UploadStream", subject);
// getting the byte data and calling next  in a loop. 
subject.next(data);

I am using ASP .NET core signalR library. These are the packages installed at the server side: Microsoft.AspNetCore 1.1.0 , Microsoft.AspNetCore.SignalR.Common 1.1.0,Microsoft.AspNetCore.SignalR.Core 1.1.0, Microsoft.AspNetCore.SignalR.PRotocols.MessagePack 1.1.0

At the client side, I have the latest preview release. "@aspnet/signalr": "3.0.0-preview6.19307.2", "@aspnet/signalr-protocol-msgpack": "3.0.0-preview6.19307.2",

I tried searching for the right package to install for ASP .NET framework but didn't find anything. Is this functionality available for .NET framework 4.6.1.

When I am calling the UploadaStream function from the client side. I have received an error specifying that unable to invoke the "UploadStream" function. Please tell me the right set of the package to install.

Panagiotis Kanavos
  • 120,703
  • 13
  • 188
  • 236
  • [Event Streaming](https://learn.microsoft.com/en-us/aspnet/core/signalr/streaming?view=aspnetcore-2.2) is only available in ASP.NET Core SignalR. This is a completely different library from the old SignalR. The differences are described [here](https://learn.microsoft.com/en-us/aspnet/core/signalr/version-differences?view=aspnetcore-2.2). The two libraries aren't compatible and client code written for one can't communicate with the other – Panagiotis Kanavos Sep 12 '19 at 09:43
  • You *can* use the ASP.NET Core SignalR library in the old .NET Framework by installing the [Microsoft.AspNetCore.SignalR](https://www.nuget.org/packages/Microsoft.AspNetCore.SignalR/) package – Panagiotis Kanavos Sep 12 '19 at 09:44
  • I am already using Microsoft.AspNetCore.SignalR library as I mentioned – mitanshu mittal Sep 19 '19 at 01:36

0 Answers0