Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

116
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!