renathy
renathy

Reputation: 5345

call webapi from client side that contains additional thread

I need to have ajax call to webapi that: 1) do Calculation method that return List, and this list should be returned to client side I have the method that does this.

However, now I need to add additional calculations like this:

2) in the same webapi method I need to call method FindBreak, that returns double, but I want to call it in seperate thread and afterwards return to client side.

I never worked with threads / tasks, can you suggest me how to deal with this?

.NET 4.5, webapi

Upvotes: 0

Views: 103

Answers (1)

Max Brodin
Max Brodin

Reputation: 3938

Based on your question details so far: To start background task you should use Hangfire or simular lib like

BackgroundJob.Enqueue(() => FindBreak());

If afterwards return to client side means the ability of your server-side code push content to the connected clients you should use SignalR

Upvotes: 1

Related Questions