Hello Marco,
Streaming mode is enabled by not resuming the connection after each event
along with that the client does not try to close the connection after each
event.
Streaming mode does per definition not prevent lost messages, it only lowers
the probability.
(Even a streaming client will need to reconnect due to transport errors etc)
We are about to implement JMS support for comet, that will allow for durable
subscriptions.
2009/1/21 marcoflower <marcofiore1983_at_gmail.com>
>
> // CLIENT
> public void comet() {
> cometService.comet(new AsyncCallback() {
>
> public void onFailure(Throwable caught) {
> }
>
> public void onSuccess(Object result) {
> Message msg = (Message) result;
> cometService.comet(this);
> ....
> }
> });
> }
>
>
> // SERVER
> class GWTCometHandler implements CometHandler<HttpServletResponse> {
>
> HttpServletResponse res;
> HttpServletRequest req;
>
> public void onEvent(CometEvent ce) throws IOException{
> System.out.println("onEvent");
>
> Message msg = (Message) ce.attachment();
> try {
> String encoded =
>
> RPC.encodeResponseForSuccess(CometServiceImpl.class.getMethod("comet"),
> msg);
> System.out.println("encoded=" + encoded);
>
> PrintWriter writer = res.getWriter();
> writer.write(encoded);
> writer.flush();
> cc.resumeCometHandler(this);
> }
> catch (SecurityException e) {
> System.out.println("onEvent:e=" + e);
> e.printStackTrace();
> }
> catch (SerializationException e) {
> System.out.println("onEvent:e=" + e);
> e.printStackTrace();
> }
> catch (NoSuchMethodException e) {
> System.out.println("onEvent:e=" + e);
> e.printStackTrace();
> }
> }
>
> ..........
>
> Hi,
>
> (I'm using GlassfishV2). I call the onEvent method using comet.notify(msg,
> CometEvent.NOTIFY)
> Using this code my application works fine: when I receve a notification, I
> resume the connection (using cc.resumeCometHandler(this)), the GWT-RPC
> call
> can receive its Message and then I have to recall cometService.comet(this)
> in order to receive next Message. But this is the long poll mode, that's
> right?
> But I've got a very fast notifier and using the poll mode the client lost
> some notifications between the resume connection and the new connection...
> For this reason I'd like to use the streaming mode. How can I developing it
> using GWT-RPC?
>
> Thanks
>
> Marco
> --
> View this message in context:
> http://www.nabble.com/GWT-%2B-Comet-question-%28was-Re%3A--Jean-Francois-Arcand%27s-Blog--New-Comment-Posted-to-%27Building-GWT-Comet-based-web-app-using-Grizzly-Comet%27-tp21416392p21578011.html
> Sent from the Grizzly - Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_grizzly.dev.java.net
> For additional commands, e-mail: users-help_at_grizzly.dev.java.net
>
>
--
your servant
gustav trede
coding is art - not only something that bring food on the table,
everybody should be able to feel proud about their code,
that they have performed their best considering the given conditions.