Friday, February 10, 2012

EJB - GWT. Notificate GWT(javaScript) client about some events happened


I want to make document printing service using GWT(javascript+servlet) and EJB. What is the best way to cause EJB to notificate GWT client about some event is happened?



Of course, I can make it with using Timer (send request to EJB with some interval), but may be exist some more elegant way? (for example with callback, but I dont understand how to release it).



P.S.: I will use multitier architectur: JavaScript(GWT)+Servlet(GWT RPC)+EJB. And i working on document printing service (i want to notificate client that some file(s) is printed (also will be good if you give me advice of making progress bar)).



Thanks!

1 comment:

  1. You have multiple options:

    -Polling (e.g. using timer to send requests to the server)

    -WebSockets (server can directly notify the client about changes, but sockets aren't supported in IE family yet)

    -Some framework, which just magically does stuff for you (for example gwt-comet)

    Personally I would use polling, because may be it is slow and doesn't use server resources effectively, but it is the most stable one.

    ReplyDelete