CometActor using Html5

86 views
Skip to first unread message

jsu

unread,
Nov 14, 2011, 1:50:54 PM11/14/11
to Lift
Hello, I am trying to get Comet to work with html5 markup. I can only
get the default render to show up. Are there any samples of html5
CometActor markup? In my sample below only "Testing comet!" shows up.

comet.html:
<div class="lift:CometExample"></div>

CometExample.scala:
package code.snippet

import net.liftweb.http._
import net.liftweb.util._
import net.liftweb.actor._
import net.liftweb.http.js.JsCmds.{SetHtml}

import scala.xml._

class CometExample extends CometActor {
def render = {
<section id="cometId">Testing comet!</section>
}
def render(in: NodeSeq): NodeSeq = {
<section id="cometId">Default render...</section>
}
ActorPing.schedule(this, Message, 10000L)

override def lowPriority : PartialFunction[Any,Unit] = {
case Message => {
partialUpdate(SetHtml("cometId", <section id="cometId">Updated!</
section>))
ActorPing.schedule(this, Message, 10000L)
}
}

case object Message
}

David Pollak

unread,
Nov 14, 2011, 2:00:58 PM11/14/11
to lif...@googlegroups.com
In order to invoke a CometActor, you must use the Comet snippet:

<div class="lift:comet?type=CometExample"></div>

jsu

unread,
Nov 14, 2011, 2:09:33 PM11/14/11
to Lift
Thanks, that worked. I also found out you have to be in the code.comet
package.

package code.snippet -> package code.comet
Reply all
Reply to author
Forward
0 new messages