I have an MVC 3 application (A) which allows multiple clients to process data forms - for example a survey form. There is an external process (B) to which the survey forms are sent. The external process (B) then figures out how many clients are working to process these survey forms (there may be thousands of surveys) and distributes as many of the the current set of surveys to each client (where each client can hold a fixed number of surveys) such that when the client logs into the main application (A) he will log into the processing application and that client will be shown a subset of the unprocessed forms which he/she can then select to work on. When the client has chosen one or more items to work on from the list, those items are removed from the list. There may not be enough clients at any given time to fullfill all of the outstanding unprocessed surveys, but the external process re-distributes the surveys to the current set of logged on clients every refresh interval (say 15 minutes.)
Now, say more clients log on to get some of these items to work on; this causes the Process (B) to redistribute the unprocessed survey forms to all current active (logged in) clients.
The problem:
when the client logs in he will see a list of surveys that he can work on. However, if he does not process all of the displayed surveys in the 15 minute period following his logging in, then the external process (B) will have redistributed the surveys so that what he currently sees on his screen my no longer be accurate. All he has to do is to refresh his page and he'll get the latest set. But I'd like him to not have to refresh but rather I'd like to have the external process (B) send an event that would cause the partial view which shows the client's list of surveys to update with the latest view.
I have been searching for a way to do this but so far haven't come up with any ideas.
The data that needs updated is in a partial view so if I could subscribe to some kind of event then when the process (B) had new data it could fire this event and I could pick it up.
In this situation the entire application is an intranet application so the service and the clients are in the same building and are all inside the firewall.
What I would like to be able to do is something like this:
public myController
{
public ActionResult Index()
{
var results = MyRepository.GetNewSurveys();
var viewModel = new ViewModel() { Results = results};
return View(viewModel);
}
public void SomeEventHandler()
{
}
Index.cshtml here...
@using ViewModel
<div>
<h2>My View</h2>
<p> some data here </p>
<div id="mypartialView">
@{html.Renderpartial("_results", Model.Results);}
</div>
</div>
Thanks in advance