.net core – binance.net update view in real time from data model websockets

Hello all,
I have a .Net Core application and I’m using the Binance.Net API. I want to show the trades coming in real time and update my View with the current trades. I’m not sure the correct way to do this. Possibly ajax? The data that is coming in is all c# so that makes it harder where I cant use javascript websockets to update the UI. Unless there is a way around this.
I have a View and also a partialview with a listbox in it. Currently as the websocket data comes in I add it to a model and if I click the button in my partial the listbox shows the recent trades. So I am partially there.
public async Task Index()
{
_logger.LogInformation(“Start Capture”);
//var price = await _marketFeed.StartBTCCapture();

        //var incomingBTC = await _binanceSocketClient.SubscribeToTradeUpdatesAsync("BTCUSD", (data) =>
        //{
        //    //(data);
        //    // _logger.LogInformation(data.Price.ToString());
        //    Console.WriteLine(data.Price);
        //});
        List<TradeResult> trades = new List<TradeResult>();
        await GetPartial(trades);
        //_logger.LogInformation(price.Data);
        //var conn = new WebSocket();

        //HttpListener httpListener = new HttpListener();
        //httpListener.Prefixes.Add("ws://localhost:50021/StartBTCCapture");
        //httpListener.Start();
        //var buffer = new byte[1024 * 4];

        //HttpListenerContext context = await httpListener.GetContextAsync();
        //if (context.Request.IsWebSocketRequest)
        //{
        //    HttpListenerWebSocketContext webSocketContext = await context.AcceptWebSocketAsync(null);
        //    WebSocket webSocket = webSocketContext.WebSocket;
        //    while (webSocket.State == WebSocketState.Open)
        //    {
        //        await webSocket.ReceiveAsync(new ArraySegment<byte>(buffer), CancellationToken.None);
        //    }
        //}

        return View();
    }

    public async Task<IActionResult> GetPartial(List<TradeResult> trades)
    {


        var incomingBTC = await _binanceSocketClient.SubscribeToTradeUpdatesAsync("BTCUSD", (data) =>
        {
            //(data);
            // _logger.LogInformation(data.Price.ToString());
            Console.WriteLine(data.Price);
            trades.Add(new TradeResult
            {
                Price = data.Price
            });

        });

        return PartialView("BoxView", trades);
    }

//Partial

@foreach(var obj in Model) { }
Price
@obj.Price.ToString()
.NET Foundation Website | Blog | Projects | Code of Conduct