Hi Simon,

The simplest way of making Comet work is to have a hidden iframe on the page, 
and
get your long-running server-side process to send it <script> tags - these will
be evaluated immediately. It's a bit hacky, but it will work.

Biggest gotcha is that your browser will generally limit itself to two 
concurrent
HTTP connections (IE and FF both do this, not sure about Safari/Opera). For as
long as your Comet request is active, you're running on half-steam, and if you
open two comet requests at once, you'll block the browser completely until one 
of
them closes.

You can do Comet with XHR, but it's a bit more fiddly than the Iframe 
trechnique,
as you can't rely on onreadystatechange to notify you of updates.

The Cometd/Bayeux people are building a proper pub/sub framework on top of all
this, but it's early days.

HTH

Dave
----------------------
Author
Ajax in Action http://manning.com/crane
Ajax in Practice http://manning.com/crane2
Prototype & Scriptaculous in Action http://manning.com/crane3


On Thursday 12 April 2007 19:47, Simon wrote:
> I'm gave a general scenario above as I will use it for many different
> things.
>
> I looked into those links you sent, and as I understand quickly, it
> simply uses a different technology (like java) instead of js... right?
>
> And you said persistance is in a very early stage, can you point out
> to what's the current state of it? (is it a compatibility problem,
> etc...) or just tell me where/how to find info about it, i googled in
> vain.
>
> Thanks a lot,
>   Simon
>
> On Apr 12, 1:40 pm, Peter De Berdt <[EMAIL PROTECTED]> wrote:
> > On 12 Apr 2007, at 20:04, Simon wrote:
> > > Normally, an ajax call would only be able to read the response at the
> > > end of this scenario.  Best would be to intercept the "In progress"
> > > and do some client-side stuff (tell the user) and wait for the rest of
> > > the response and do stuff each time the server sends something new
> > > (like "10% complete", etc..).
> > >
> > > I believe this would be done using the keepalive keyword but I'm
> > > not sure.
> > >
> > > Another way is to make a request every seconds (or more) to query the
> > > job status, but this is the ugliest way of doing this IMO (wastes time
> > > and server resources).
> > >
> > > So, is it possible to combine the power of server flushes and ajax
> > > reading as it downloads?  And how (if it uses functions, can you tell
> > > them to me as keywords so I can document myself further?)
> >
> > Persistent connections are still in a very early stage and a
> > periodical updater (so a request every x seconds) is probably the
> > best way to go. If you still insist on persistence, you can check out
> > Comet, Meebo uses it for example, as does GTalk. More info:
> > http://www.cometd.com/andhttp://ajaxian.com/by/topic/comet/
> >
> > If you're looking into upload progress, you have a few other options,
> > such as SWFUpload, where the Flash movie keeps track of the upload
> > progress (on the client side).
> >
> > Best regards
> >
> > Peter De Berdt
>
> >
>
> --
> This email has been verified as Virus free
> Virus Protection and more available at http://www.plus.net


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Spinoffs" 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/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to