I tested both FF and IE6 . I'm pretty surprised too of the results, so
I'm
 still searching the problem.

>Are you calling getEvents (the one
> that sends of the request to the server) on the client-side more than once?

Yes, i checked it after you said that two requests is the maximum.
I call the getEvents  only once, after logging in.
There is also something weird happens when it runs in browser .
In the getEvents on server side in this part

try
{
       synchronized( user )
       {
               user.wait( 20*1000 );
       }
}
catch ( InterruptedException ignored )
{
        System.out.println("Server interupted, sending response");
}

when interrupted the message is not printed. It does not enter the
catch clause at all.
I've added some print after wait in the try
clause,  and when the server interrupted the message in the try clause
printed.
Is it magic or something ????? )))))))))))



On Apr 23, 12:01 pm, Vitali Lovich <[email protected]> wrote:
> Seriously doubt it's a hosted mode mode issue.  Which browser did you test
> web-mode with?  Hosted mode actually launches a version of IE6, so using FF
> or IE7 may present different issues (for instance they might have a raised
> AJAX connection limit)
>
> The issue is purely on the client side.  Are you calling getEvents (the one
> that sends of the request to the server) on the client-side more than once?
>
> On Thu, Apr 23, 2009 at 4:44 AM, [email protected]
> <[email protected]>wrote:
>
>
>
> > Well, it really looks like a bug, cause when i
> > compile it to browser it works properly ( meanwhile )))) ).
> > Thanks for your answers.
>
> > On Apr 23, 10:05 am, Salvador Diaz <[email protected]> wrote:
> > > As Vitali said, there are some common pitfalls when trying to
> > > implement something along the lines of whatyou're trying to do.
> > > There have been plenty of discussions related to chat implementations
> > > and server-push. You might want to look at this docs:
> >http://docs.codehaus.org/display/JETTY/GWT+RPC+Exampleshttp://code.go....
> > ..
> > > And also comment on this bug if you have any problems or even if you
> > > succeed:http://code.google.com/p/google-web-toolkit/issues/detail?id=267
>
> > > Hope it helps,
>
> > > Salvador
>
> > > On Apr 23, 9:40 am, "[email protected]" <[email protected]>
> > > wrote:
>
> > > > I open two clients, and trying to send a message from one to another.
> > > > So i have two requests hanging on server's side, and the third one
> > > > trying to send the message.
> > > > the server side is like this :
>
> > > >         @Override
> > > >         public ArrayList<Event> getEvents( Integer sessionId )
> > > >         {
> > > >                 UserInfo user = getUserById( sessionId );;
> > > >                 ArrayList< Event > events = null ;
>
> > > >                 if( user != null )
> > > >                 {
> > > >                         if( user.events.size() == 0 )
> > > >                         {
> > > >                                 try
> > > >                                 {
> > > >                                         synchronized( user )
> > > >                                         {
> > > >                                                 user.wait( 20*1000 );
> > > >                                         }
> > > >                                 }
> > > >                                 catch ( InterruptedException ignored )
> > {}
> > > >                         }
> > > >                         synchronized( user )
> > > >                         {
> > > >                                 events = user.events;
> > > >                                 user.events = = new ArrayList<Event>();
> >  ;
> > > >                         }
> > > >                 }
> > > >                 return events;
> > > >         }
>
> > > > And the sendEvent() on the server side is like this :
>
> > > >         @Override
> > > >         public void sendEvent( Integer senderId, Integer recieverId,
> > String
> > > > message )
> > > >         {
> > > >                System.out.println( senderId + "entered the sendMessage
> > > > method" );
>
> > > >                 UserInfo reciever = getUserById( recieverId );
> > > >                 MessageEvent me = new MessageEvent( senderId , message
> > );
>
> > > >                 if( reciever != null )
> > > >                 {
> > > >                         synchronized( reciever )
> > > >                         {
> > > >                                 reciever.events.add( me );
> > > >                                 reciever.notifyAll();
> > > >                         }
> > > >                 }
> > > >         }
> > > > So I have two clients opened in hosted mode. For debugging
> > > > i put System.out.println( senderId + "entered the sendEvent method" );
> > > > command at the enter
> > > > to sendEvent() method. And the message "senderId entered the sendEvent
> > > > method" appeared, only when
> > > > one of the clients exited the getEvents(). So maybe the problem is
> > > > that both clients are opened at the same
> > > > computer, or maybe it's because of hosted mode  ?
>
> > > > On Apr 22, 11:56 pm, Vitali Lovich <[email protected]> wrote:
>
> > > > > Most browsers only support 2 outstanding AJAX events - that may be
> > what you
> > > > > are running into.  Without knowing what other calls you make, I
> > cannot make
> > > > > a recommendation.
>
> > > > > One thing that does come to mind is that I hope you only call
> > getEvents once
> > > > > on startup.
>
> > > > > On Wed, Apr 22, 2009 at 4:47 PM, [email protected]
> > > > > <[email protected]>wrote:
>
> > > > > > Hi.
> > > > > > I'm trying to implement chat on my GWT app. So client has
> > getEvents()
> > > > > > function implemented like this :
>
> > > > > >   public void getEvents( )
> > > > > >    {
> > > > > >        networkSvc.getEvents(
> > > > > >                       new AsyncCallback< ArrayList<Event> >()
> > > > > >                        {
> > > > > >                                public void onSuccess( ArrayList<
> > Event >
> > > > > > events )
> > > > > >                                {
> > > > > >                                        handleEvents( events );
> > > > > >                                        networkSvc.getEvents( this
> > );
> > > > > >                                }
> > > > > >                                public void onFailure( Throwable
> > caught )
> > > > > >                                {
>
> >  System.out.println("eventListner " +
> > > > > > caught );
> > > > > >                                }
> > > > > >                        }
> > > > > >        );
> > > > > >    }
>
> > > > > > This func in an endless loop with the server .
> > > > > > at the server side getEvents goes to sleep for 30 sec or till
> > events
> > > > > > approaching.
> > > > > > The second function is sendEvent() function.
> > > > > > As i see, i can't send an event to server while the server
> > processing
> > > > > > the previos request.
> > > > > > I mean it looks like the sendEvent() waits till the getEvents()
> > gets
> > > > > > the response,
> > > > > > and just after that it sends its own request.
> > > > > > Is that right, or there is some bug in my algorithm ?
--~--~---------~--~----~------------~-------~--~----~
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