实时Web功能 [英] Real Time Web functionlity

查看:100
本文介绍了实时Web功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我是asp.net的新手。我有一个mysql数据库存储我从特定网站提取的总记录。我的要求就像每当新记录添加到数据库时我的应用程序应该显示记录的实时更改。



例如

如果我在我的应用程序中有一个标签,例如totalrecords = somevalue,某些值应该根据新添加的记录的数量而改变。任何人都可以告诉我如何实现这一点。





谢谢

Hi,
I am pretty new to asp.net. I have a mysql database which am storing total records that i extracted from a particular site.My requirement is like whenever a new record is addded to DB my application should show the realtime change of records.

For eg
if i have a lable in my application like totalrecords=somevalue that somevalue should change according to number of newly added records.Can anyone pls tell how i can acheive this.


thanks

推荐答案

这有多种方法。您可以自己完成此操作,因为您知道用户何时更新内容,或者您​​可以让服务器处理此问题并将数据发送给客户端。



您可以使用ASP.NET技术使用WebSockets发送请求并从服务器调用数据。 ASP.NET SignalR是一种提供实时应用程序功能的技术。



您可以在ASP.NET应用程序中使用它,并学习如何从ASP.NET网站实现它。 http://www.asp.net/signalr [ ^ ]他们有一个很好的文档来说明这项技术。



SignalR让您的服务器进行通信与客户。您可以随时发送数据到服务器,然后使用SignalR技术将数据推送到客户端(正如Sergey也提到的那样,推送和拉取技术)。这些数据将被捕获并使用JavaScript等呈现到HTML中。



这是一个广泛的主题,因此从ASP学习SignalR会很好.NET网站。他们有很棒的教程和一个很好的论坛供你讨论它。
There are multiple approaches for this. You can do this on yourself, as you know when the user will update the content, or you can either let the server handle this and send the data to the client.

You can use the ASP.NET technology to send the requests and call for data from the server using the WebSockets. ASP.NET SignalR is a technology that provides the functionality of "Real Time" applications.

You can use this in your ASP.NET application, and learn how to implement it from the ASP.NET website. http://www.asp.net/signalr[^] They have a great document for this technology.

SignalR lets your server to communicate with the clients. You can send the data whenever you want to the server, and then use the SignalR technology to push (as Sergey has also mentioned, push and pull technology) the data to the client. This data will be captured and rendered into the HTML using JavaScript and so on.

This is a broad topic, so it will be good to learn the SignalR from the ASP.NET website. They're having great tutorials and a great forum for you to discuss the things about it.


请看我对这个问题的评论。问题不是很清楚,但有可能一切都归结为推技术拉技术这个非常严重的问题。



对于某些背景,请参阅我过去的答案:申请表'仪表板'用于网站帐户 [ ^ ]。



-SA
Please see my comment to the question. The question is not really clear, but it's possible that everything boils down to a very serious problem of push technology vs pull technology.

For some background, please see my past answer: Application 'dashboard' for website accounts[^].

—SA


嗯,赢了不是实时的,因为那是另一回事。正如SA所述,网上没有实时信息。系统没有实时(如果不是全部) - 包括所有操作系统和网络都满足一些标准。

但是,你可以实现你所描述的。正如SA所述,有两种方法可以向另一方发送信息:推拉。 Web默认是拉 - 因为http是无状态的。尽管如此,在html5之前还有一些有趣的举措可以实现推送方法 - 让http连接保持打开状态(参见: http:// en.wikipedia.org/wiki/Comet_(programming) [ ^ ],Gmail曾经使用过这样的方法)。使用html5,您有WebSockets。

如果出于某些原因,这些都不起作用,你仍然可以使用普通的旧计划ajay查询。

由于客户端和服务器之间可能存在多方,因此在任何情况下都必须考虑相当大的延迟。所以它不会是实时的。



不过,如果你想要相似,你可以拥有它。如果您不想自己编写所有替代方案,那么您可以使用以下工具: http://signalr.net/ [ ^ ]
Well, it won't be real-time, since that is something else. As SA stated, there is no real-time on the web. There is no real-time if not all components of the system - including all OS and network fulfill some criterias.
But, you can achieve what you described. As SA stated, there are two approaches to send information to an other party: push and pull. Web is "pull" by default - since http is stateless. Still, there were interesting initiatives to implement push approach even before html5 - to have http connections kept open (see: http://en.wikipedia.org/wiki/Comet_(programming)[^], Gmail used to use such an approach). With html5, you have WebSockets.
And if for some reason none of these work, you still have the plain old scheduled ajay query.
Well as there can be many parties between the client and the server, you have to take into account a considerable latency in any case. So it won't be real-time.

Still, if you want to feel alike, you can have it. And if you don't want to code yourself all alternatives, here you have the tool you can use for sure: http://signalr.net/[^]


这篇关于实时Web功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆