简体   繁体   English

Asp.net MVC-从服务器推送延迟的客户端消息

[英]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.

相关问题 从Android客户端轮询asp.net MVC服务器 - Polling asp.net MVC server from an Android client ASP.NET MVC客户端验证消息错误 - ASP.NET MVC Client Side Validation Message Error 有关ASP.NET MVC客户端验证的正确消息 - Correct message for ASP.NET MVC client side Validation 如何从.NET客户端上的ASP.NET MVC5 +身份服务器接收身份验证失败? - How to receive auth failure from ASP.NET MVC5+Identity server on .NET client? 在 ASP.NET Core SignalR 中,如何从服务器向客户端发送消息? - In ASP.NET Core SignalR, how do I send a message from the server to a client? 在ASP.NET MVC中将客户端日期时间转换为服务器日期时间 - Convert a client datetime to server datetime in ASP.NET MVC ASP.NET MVC 中的客户端和服务器端验证 - Client side & Server side validations in ASP.NET MVC 什么是ASP.NET MVC的客户端/服务器等效项 - What is the Client/Server Equivalent for ASP.NET MVC 是否在Asp.net MVC中延期执行查看非常糟糕的事情? - Is Deferred Execution in Asp.net MVC View a very bad thing? 在 ASP.Net MVC 中显示来自服务器端验证的成功验证消息 - Showing a success validation message in ASP.Net MVC from server side validation
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM