I''m trying to write an ajax chat. I''m noticing that when ajax requests are fired off in rapid succession, they often will arrive out of order to the server. Has anyone experienced this problem, and perhaps implemented some kind of queueing system? Any other suggestions? Thanks! Thanks, Joshua Sierles
You may want to try putting sequence numbers on each request so if one comes in that is out of order, you'll know. Travis On 11/11/05, Joshua Sierles <jsierles@gmail.com> wrote:> > I'm trying to write an ajax chat. I'm noticing that when ajax requests > are fired off > in rapid succession, they often will arrive out of order to the > server. Has anyone > experienced this problem, and perhaps implemented some kind of queueing > system? > Any other suggestions? Thanks! > > Thanks, > Joshua Sierles > _______________________________________________ > Rails-spinoffs mailing list > Rails-spinoffs@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs >_______________________________________________ Rails-spinoffs mailing list Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
That''s a possibility, but that would require a delay on the server side where I buffer X number of connections and make sure they are ordered correctly before those messages are saved to the db, or sent off to another user. So, if there has to be a buffer, where? Joshua Sierles On 11/12/05, Travis Reeder <treeder-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> You may want to try putting sequence numbers on each request so if one comes > in that is out of order, you''ll know. > > Travis > > > On 11/11/05, Joshua Sierles <jsierles-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > I''m trying to write an ajax chat. I''m noticing that when ajax requests > > are fired off > > in rapid succession, they often will arrive out of order to the > > server. Has anyone > > experienced this problem, and perhaps implemented some kind of queueing > system? > > Any other suggestions? Thanks! > > > > Thanks, > > Joshua Sierles > > _______________________________________________ > > Rails-spinoffs mailing list > > Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > > > http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs > > > > > _______________________________________________ > Rails-spinoffs mailing list > Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs > > >
Joshua Sierles wrote:> That''s a possibility, but that would require a delay on the server > side where I buffer X number of connections and make sure they are > ordered correctly before those messages are saved to the db, or sent > off to another user. So, if there has to be a buffer, where?It would also require that the server processes talk to each other, which may be a little on the complicated side. I would suggest that each time you want to send a request to the server you instead put that information into an array and have something monitor the array and send each request in the order that it happens. -- Michael Peters Developer Plus Three, LP
I noticed that a queueing mechanism like this has been added to scriptaculous for visual effects. Maybe it could be adapted for Prototype? Ajax.ThrottledRequest Joshua Sierles On 11/12/05, Michael Peters <mpeters-aUYv5hkjw45l57MIdRCFDg@public.gmane.org> wrote:> > > Joshua Sierles wrote: > > That''s a possibility, but that would require a delay on the server > > side where I buffer X number of connections and make sure they are > > ordered correctly before those messages are saved to the db, or sent > > off to another user. So, if there has to be a buffer, where? > > It would also require that the server processes talk to each other, > which may be a little on the complicated side. > > I would suggest that each time you want to send a request to the server > you instead put that information into an array and have something > monitor the array and send each request in the order that it happens. > > -- > Michael Peters > Developer > Plus Three, LP > > _______________________________________________ > Rails-spinoffs mailing list > Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs >