开发者

GWT Servlet-based Notification (Server Event Bus)

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 deleti开发者_如何转开发on 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.


You want server events for GWT? Have a look at GwtEventService (they couldn't have chosen a better name): http://code.google.com/p/gwteventservice/wiki/StartPage

Of course, it uses a Comet implementation, but you can't do any different when using HTTP, the client always initiates the communication. Request, response.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜