如何显示堆栈溢出站点中的更新消息

[英]how the update messages in stack overflow site are being shown


i would like to know how the update messages in this stack overflow site have been implemented.

我想知道如何实现此堆栈溢出站点中的更新消息。

To be more precise, for example while i am trying to reply for question and i am in the middle of typing my response, i will see a message on top of the page saying a new answer has been added. How is this feature has been implemented.

更确切地说,例如,当我试图回答问题并且我正在键入我的回复时,我会在页面顶部看到一条消息,说明已添加新答案。该功能是如何实现的。

AFAIK, the possible way can be HTML5 websocket or serversocket technology. is there any other way to achieve this kind of push notification system especially using java, spring and jquery environment?

AFAIK,可能的方式可以是HTML5 websocket或serversocket技术。有没有其他方法来实现这种推送通知系统,尤其是使用java,spring和jquery环境?

Not sure how to tag this question. correct the tags if i am wrong.

不确定如何标记这个问题。如果我错了,请更正标签。

3 个解决方案

#1


2  

I have used the Direct Web Remoting framework with success. (DWR).

我已成功使用Direct Web Remoting框架。 (DWR)。

#2


6  

SO uses reverse ajax/comet technology to show those messages. I remember reading some discussion on meta about this feature, couldn't exactly find out the link for it at this moment. Will update as soon as I find.

SO使用反向ajax / comet技术来显示这些消息。我记得在阅读有关此功能的meta的一些讨论时,目前无法找到它的链接。我会尽快更新。

Based on programming language framework name may change (websockets (or) socket.io etc.,), but at the end they all are from comet framework.

基于编程语言框架名称可能会更改(websockets(或)socket.io等),但最后它们都来自彗星框架。

Update:

更新:

Here is SO meta discussion on this topic.

这是关于这个主题的SO元讨论。

#3


2  

There are several ways to achieve that:

有几种方法可以实现这一目标:

  • Polling: using JQuery you issue a request regularly (every 5sec for examples) which retrieves the updates from the server.
  • 轮询:使用JQuery定期发出请求(例如每5秒),从服务器检索更新。
  • Streaming: you issue a request, the server does not set a Content-Length to the response and "never" close the socket. This way you can send data from server to client whenever you want. But it means that for every client a connection is hold by your server.
  • 流式传输:您发出请求,服务器不会为响应设置Content-Length并且“从不”关闭套接字。这样,您可以随时从服务器向客户端发送数据。但这意味着对于每个客户端,服务器都会保持连接。
  • Long polling: mix between the two previous ways. The connection is hold by the server but with a timeout. If no new data is available, the server closes the connection and the client reopen a new one after a moment.
  • 长轮询:在前两种方式之间进行混合。连接由服务器保持但超时。如果没有可用的新数据,服务器将关闭连接,客户端稍后会重新打开一个新数据。

Thoses are Push technologies: http://en.wikipedia.org/wiki/Push_technology

Thoses是Push技术:http://en.wikipedia.org/wiki/Push_technology

Of course there are over ways to achieve that.

当然,有很多方法可以实现这一目标。


注意!

本站翻译的文章,版权归属于本站,未经许可禁止转摘,转摘请注明本文地址:http://www.itdaan.com/blog/2012/10/09/f2448bdd5f7201cb1e3859ea7436f9ec.html



 
© 2014-2018 ITdaan.com 粤ICP备14056181号