如何使新的重播立即出现在对话中? [英] How to make new replay appears immediately in conversation ?

查看:78
本文介绍了如何使新的重播立即出现在对话中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好:)



我有一个对话页面,我希望任何消息在提交后立即显示在对话中,



例如在Facebook中回复



我使用C#.Net,ASP.Net,SQL Server 2008 R2





谢谢大家:)

hi all :)



I have a conversation page, and I want any message appears immediately to the conversation after submit it,



like replies in facebook for example



I use C#.Net, ASP.Net, SQL Server 2008 R2





thank you all :)

推荐答案

当然,您可以轻松地更新用于发布消息的页面.真正的问题是在其他人发布消息时更新页面.这是因为Web是基于纯客户端服务器的,因此没有客户端请求就不会发生任何事情.因此,该解决方案通常效果不佳-这是对服务器的轮询,大概是使用Ajax.

触发这种轮询的原因是什么?当然,应该对每个帖子都进行轮询,并且可能响应于客户端上的某些用户活动.但是,如果用户甚至没有触摸键盘和鼠标,应该执行轮询该怎么办.剩下的唯一事件是JavaScript计时器.轮询通常是不好的.计时器轮询是最糟糕的.如果轮询频率太高,则说明网络工作过度,流量被过度使用,甚至没有提及服务器和客户端主机.如果减少轮询的频率,则会降低响应速度,延迟邮件的可视化.

定时轮询的另一种深奥而灵活的方法是使用 Worker Threads .参见 http://bradkellett.com/p/javascript-worker-threads/ [ http://en.wikipedia.org/wiki/Pull_technology [ ^ ].

最根本的方法是使用推送技术(也称为服务器推送),请参见 ^ ],但这一点都不容易.不幸的是,此类技术的使用严格限于可用的Web浏览器.使用工作线程也是如此.据我所知,目前将这些先进技术与IE结合使用是无望的,Mozilla Firefox/Seamonkey,Opera以及Safary在某些方面更加灵活.

—SA
Of course you can easily update the page used to post the message. The real problem is to update the page when someone else posts a message. This is because the Web is based on pure client-server, so nothing happens without client request. So, the solution is generally not very effective — this is polling of the server, presumably using Ajax.

What would be the trigger for such polling? Of course, the polling should be done on each and every post and perhaps in response to some user activity on the client. But what to do if the polling should be done if the user does not even touch keyboard and mouse. The only remaining event would be JavaScript timer. Polling is in general bad; polling by timer is the worst. If you poll too often, you the network overworks, traffic is overused, not even mentioning the server and client hosts. If you reduce the frequency of polling, you reduce responsiveness, delay visualization of messages.

One more esoteric and flexible way of timed polling is using Worker Threads. See http://bradkellett.com/p/javascript-worker-threads/[^].

The problem is inherent to the nature of client-server, the polling, the exclusive use of pull technology, see http://en.wikipedia.org/wiki/Pull_technology[^].

The most radical approach is the use of push technology, also called server push, see http://en.wikipedia.org/wiki/Server-push[^], but this is not easy at all. Unfortunately, the use of such technologies is strongly limited to available Web browser; the same is true for using of Worker Threads. To best of my knowledge, using these advanced technologies with IE is presently hopeless, Mozilla Firefox/Seamonkey, Opera and in some aspect Safary being more flexible.

—SA


使用线程.
创建一个线程,该线程将连续检查某些消息是否已在数据库中更新.
如果已更新,则显示该消息...

因此,您可以使用线程.
Use threading.
Create a thread which will continuously check some message is updated in database or not.
If updated the show that message...

So u can use threading.


这篇关于如何使新的重播立即出现在对话中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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