users@grizzly.java.net

Re: info about comet and gwt

From: Jeanfrancois Arcand <Jeanfrancois.Arcand_at_Sun.COM>
Date: Thu, 26 Feb 2009 12:47:33 -0500

Salut,

Stefano Ruffolo wrote:
> Hi,
> I have tried the example that you given me (MyApplication.jar), and it's ok!

Great!

> I have just modified this example, I have inserted a Texarea with a
> Button, so I want notify the message that I have written in the TextArea
> (to All contact tha are connected).
> I don't know how to do.

Can you share you code? Mainly, you need to get a CometContext and
invoke the notify method. Something like:

cometContext.notify(textarea_string);

and all suspended connection will be notified, e.g all
CometHandler.onEvent(..) will get a chance to decide to write the code
or not.

Does it help? If you can share a test case that will be easier to help :-)

Thanks!

-- Jeanfrancois


>
>
>
>
> Client-side :
>
> cometAsync.sendMessage(string,new AsyncCallback() {
> public void onFailure(Throwable caught) {
>
> }
> public void onSuccess(Object result) {
>
> }
>
> }
>
> Server-side:
>
> On cometServiceImpl:
>
> public String sendMessage(String s) {
>
> return null;
> }
>
>
> onEvent:
> ..
> CometServiceImpl.class.getMethod("sendMessage"),string);
> String encoded = RPC.encodeResponseForSuccess(
> writeResponse(request, response, encoded);
> removeThisFromContext();
> ....
>
>
> Thanks