[英]Asp.net MVC - Push a deferred client message from server
I have an intranet/extranet app which calls the server to do some VERY LONG calculations. 我有一个Intranet / extranet应用程序,该应用程序调用服务器进行一些非常长的计算。 The client should be able to keep surfing the site and doing his stuff, until a message pops up saying the calculation has ended and asking him if he wants to go back to the page to see the results.
客户应该能够继续浏览网站并做自己的工作,直到弹出消息说计算已结束并询问他是否要返回页面以查看结果。
If so, the client must be redirected to that page, the data must be retrieved the from the server and displayed. 如果是这样,则必须将客户端重定向到该页面,必须从服务器检索并显示数据。 If the user cancels the action, the data set must be cleared.
如果用户取消该操作,则必须清除数据集。
How do I send a message to the client from C# and how do I catch it? 如何从C#向客户端发送消息以及如何捕获它? Is it possible?
可能吗?
Thanks 谢谢
Reactive Extensions (Rx) for .NET deals with exactly this kind of problem. .NET的Reactive Extensions(Rx)恰好解决了这类问题。 It allows for "push" notifications of remote events.
它允许“推送”远程事件的通知。
Here is a blog post that introduces Rx over ASP.NET: 这是一篇介绍ASP.NET上的Rx的博客文章:
http://weblogs.asp.net/podwysocki/archive/2010/02/16/introduction-to-the-reactive-extensions-to-javascript.aspx http://weblogs.asp.net/podwysocki/archive/2010/02/16/introduction-to-the-reactive-extensions-to-javascript.aspx
Here's an entire RxJS library: 这是整个RxJS库:
http://reactive-extensions.github.io/RxJS/ http://reactive-extensions.github.io/RxJS/
是的,可以使用Web套接字或longpolling技术通过HTTP从服务器向客户端发送消息。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.