Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

125
Visualizações
Update View in real-time from Event Handler that's triggered in the Controller via Websocket

I'm getting back into stateless web dev, so I'm a little rusty right now coming from desktop app development.

Anyway, I have two projects: (1) one is a DLL that subscribes to and handles all the websocket data and (2) the other is a .NET Core web app that references the DLL. I would like to update the View in the web app in real-time from the websocket data. I'm trying to figure out how to wire everything up so that the view updates in real-time with the websocket data.

In my controller, I have this:

public async Task<IActionResult> Index(HomeModel model, string button)
{
     model.Trader.TdaClient.TdaWebsocket = new TdaWebsocket(model.Trader.TdaClient).Login();
     model.Trader.TdaClient.TdaWebsocket.StreamingNotificationResponseEventHandler += TdaWebsocket_StreamingNotificationResponseEventHandler;
     model.Trader.TdaClient.TdaWebsocket.StreamCandles(new List<string>() { model.StreamInputs.symbol });
     return View(model);
}

private void TdaWebsocket_StreamingNotificationResponseEventHandler(object sender, Responses e)
{
     ///
}

The event handler method gets hit, but am not sure how to update the View in real-time. I know that I could do all the websocket logic in JavaScript, but would rather keep it in the DLL project.

Basically, I need the websocket data to be sent to a .js file to update a chart in real-time on a partial view via a JavaScript function. Is this possible with the current configuration?

I've looked into SignalR, but cannot find any examples of how to relay the stream to the view. I think I might have to use SignalR, or code some kind of wrapper for the websocket? I'm a little stuck right now so any help would be great.

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda