基于GWT Servlet的通知(服务器事件总线) [英] GWT Servlet-based Notification (Server Event Bus)

查看:106
本文介绍了基于GWT Servlet的通知(服务器事件总线)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

任何人都可以想到一种允许服务器根据服务器处理通知客户端的好方法吗?例如,请考虑以下事件:


  1. 用户请求删除数据,但由于它的运行时间很长,我们踢了
  2. 客户收到是,我们已成功完成您的交易。

  3. 服务器删除该项目,现在想要更新任何客户端可能使用的本地结构(我也想通知用户)。

我知道这可以做到通过客户端轮询。是否有事件总线类型的方式来做到这一点?任何建议都是值得欢迎的,但请记住我正在使用GWT和App Engine。 解决方案

标准的AJAX交互是客户端向服务器发送请求,并期望相当快地回复某种响应。



为了让服务器向客户端发起请求,您需要使用< WebSockets ,以及目前仅支持Chrome的实验性HTML5功能。



或者,要模拟这种交互,您可以使用 Comet (长轮询),由GWT通过 rocket-gwt 项目。


Can anyone think of a good way to allow the server to notify the client based upon server processing? For example, consider the following events:

  1. A user requests a deletion of data, however, due to it's long-running time, we kick it off to a queue.
  2. The client receives a "Yes we completed your transaction successfully".
  3. The server deletes the item and now wants to update any local structures any clients may be using (I'd also like to notify the user).

I know this can be done by client-side polling. Is there a event bus type way to do this? Any suggestions are welcome, but please keep in mind I am using GWT with App Engine.

解决方案

The standard AJAX interaction is that the client sends requests to the server and expects some sort of response back fairly quickly.

In order for the server to initiate a request to the client, you will need to use WebSockets, and experimental HTML5 feature currently only supported by Chrome.

Or, to simulate this kind of interaction, you can use Comet (long-polling), made available in GWT by the rocket-gwt project.

这篇关于基于GWT Servlet的通知(服务器事件总线)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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