Hallo everybody,

I have just programmed a chat application to be applied to Android
(SDK m5-rc15) and to as many browsers as possible.

At present I am exploiting only the GWT (1.5.1) API, with the 'smack'
library which allows connection to a xmpp server. (For now I'm using
just Firefox as XMPP server and a Spark client).

I have a big problem: my application works perfectly with many
browsers (Chrome, IE, Mozilla, Opera), but it does not work so well on
Android.
In fact, on Android I cannot send and receive real-time messages:
sometimes I lose message, sometimes the message I send from one side
(for example from the Spark client) appears on the other side, that is
on my application running on Android, only after sending a further
message from my application itself.

My question is : why does my application not work only with Android??
Do I have to change any configuration parameter on Android for that?


Some further information about the webapp architecture:
1)  In my application the application server opens a connection to a
XMPP server, before opening a chat to any
     Spark client.
2)  On my server-side I have 4 chat methods,which I invoke from the
client by  means of RPC calls.
     Since no flush is allowed by the http protocol, actually I am
appending all received message to a inbox list
     (by means of a message listener in the chat method). The client
receives this messages invoking the receive
     method on server-side.

      Here I attach the four chat methods:


public boolean connect() {
               try {
                       connection.connect();
                       connection.login(username,psw);
               } catch (XMPPException e) {
                       e.printStackTrace();
                       return false;
               }
               return true;
}

public boolean chat(String participant){
               participantName = participant.substring(0,
participant.lastIndexOf('@'));
               this.chat1 =
connection.getChatManager().createChat(participant, new
MessageListener() {
                               public void processMessage(Chat chat1,
Message message) {
                                       msg =  participantName + ": " +
message.getBody();
                                       System.out.println("Received
message --> " + msg);
                                       synchronized(messageList){
                                               messageList.add(msg);
                                               messageList.notify();
                                       }
                               }
                               });
               return true;
}

public String send(String textIn) {
               try {
                       chat1.sendMessage(textIn);
               } catch (XMPPException e) {
                       e.printStackTrace();
               }
               textOutMod = username + ": " +  textIn;
               return textOutMod;
}

public String receive() {
               synchronized (messageList){
                 while (messageList.size() == 0){
                         try{
                       messageList.wait();
                                      } catch (InterruptedException
ignore){
                                      }
               }

               textInMod = "";
               for (int j = 0; j < messageList.size(); j++) {
                  if (textInMod.length() > 0) textInMod = textInMod +
"\n" + messageList.elementAt(j);
                     else textInMod =
(String)messageList.elementAt(j);
               }
               messageList.clear();
               }
               return textInMod;
}

thks in advance and sorry for bad English,
Steve
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to