Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

124
Vistas
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 la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda