i created a wcf service that had a method:
public List<Mail> GetMailItems()
{
//gets mails from database which were created in last two minutes
return Mails;
}
the client application was window forms and there was a refresh button that would call this method of the service.
but now, the client has asked for MVC3 as client application and want a page that calls this method every second.
can someone please help me understand how controller class logic would be implemented that would call this wcf service method every second and update the view?
thank you
If your point is to display the result in the html without reloading the page then,
I think, you have to look at the cocept of reverse ajax or comet.
I might suggest you a pseudocode here
and controller side
This is the most primitive implementation. You make a request to your action and your request is not returned immediately but held. Action starts checking mails each second. As it finds anyting to return it releases the request to the client. In javascript you make appropriate DOM updates and send the request again. If nothing is found during those 5 minutes response is returned indicating that there is no mails.
Further you may refer to the following link Websync or look at connecting to the wcf service directly via silverlight here