Comet fixes

This fixes a handful of bugs that when taken together kept things mostly working!

  - Unify lastListenerTime (which was previously always zero) with
    lastListenTime
  - Make lastRenderTime, delta timestamps, and lastListenerTime
    consistent with each other as they are directly compared
  - More accurately track whether any deltas have been sent
  - Pretend initial render happened at creation time to prevent a second
    render call from running on the initial Listen message
  - Rename devMode to alwaysReRenderOnPageLoad
Hmm... I'm not sure that's possible without copying huge swathes of
CometActor. The behavioral tweaks to CometActor are pretty minimal. In
terms of the rest of the comet infrastructure, it's just another comet
actor.

Basically we need a way to push arbitrary JavaScript code down to the
client. In other words, partialUpdate is all that's used. render is never
used. Since CometActor normally assumes that it can re-render its content
area completely, it can throw away partial updates as needed (i.e. partial
updates are just an optimization and aren't needed for correct behavior).

Basically as things stand now, partialUpdate() can't be relied upon to
actually do anything because depending on the situation CometActor may just
use render() instead and throw away pending partial updates. For the
situation above (pushing arbitrary JS to client), that's a problem.

It seems like this situation might be fairly common? Maybe a better name
above would help?



On Tue, Dec 2, 2014 at 10:04 PM, Antonio Salazar Cardozo <
notifications@github.com> wrote:

> In web/webkit/src/main/scala/net/liftweb/http/CometActor.scala:
>
> > @@ -474,12 +479,32 @@ trait CometActor extends LiftActor with LiftCometActor with CssBindImplicits {
> >     */
> >    def lastListenerTime: Long = _lastListenerTime
> >
> > +  def lastRenderTime: Long =  _lastRenderTime
> > +
> > +  /**
> > +    * If this method returns true, this CometActor will be treated as a source
> > +    * of continuous partial updates. Usually the basic assumption of a Lift
> > +    * Comet Actor is that render will display the current state of the actor.
> > +    * Partial updates may modify that display, but it is always possible to
> > +    * recreate the complete display by calling render again (in which case
> > +    * pending partial updates can be safely discarded). If this method
> > +    * returns true, render will not be called, but partial updates are
> > +    * guaranteed to always be sent to the client. This is useful as a means to
> > +    * push arbitrary JavaScript to the client without a distinct UI for the
> > +    * comet actor itself.
> > +    */
> > +  protected def partialUpdateStream_? : Boolean = false
>
> This render mode seems like it's behaving completely differently, and
> therefore shouldn't be a flag but rather a separate class altogether.
>
> Is this only intended in cases where render and partialUpdate are mixed?
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/lift/framework/pull/1619/files#r21191157>.
>