public async Task <IHttpActionResult> LongRunningProcess() { //THIS COULD BE SOME LIST OF DATA int itemsCount = 100; for (int i = 0; i <= itemsCount; i++) { //SIMULATING SOME TASK Thread.Sleep(100); //CALLING A FUNCTION THAT CALCULATES PERCENTAGE AND SENDS THE DATA TO THE CLIENT HubFunctions.SendProgress("Process in progress...", i, itemsCount); } return(Ok()); }
public JsonResult LongRunningProcess() { //THIS COULD BE SOME LIST OF DATA int itemsCount = 100; for (int i = 0; i <= itemsCount; i++) { //SIMULATING SOME TASK Thread.Sleep(100); //CALLING A FUNCTION THAT CALCULATES PERCENTAGE AND SENDS THE DATA TO THE CLIENT HubFunctions.SendProgress("Process in progress...", i, itemsCount); } return(Json("", JsonRequestBehavior.AllowGet)); }