Hi all, Here is an example code that about the ActorComet.
### package com.liftcode.comet import net.liftweb._ import http._ import js._ import JsCmds._ import net.liftweb.common._ import net.liftweb.util._ import Helpers._ import net.liftweb.http._ import _root_.scala.xml._ import scala.actors._ import scala.collection.mutable.Queue import net.liftweb.http.SessionVar case class Foo(getValue: String) object FooManager { private var foos: List[Foo] = Nil def getFoos: List[Foo] = synchronized { println("........ foos size: " + foos.size) foos ::= Foo(System.currentTimeMillis.toString) foos } } class MyComet extends CometActor { override def defaultPrefix = Full("auth") private var foos = FooManager.getFoos def createDisplay(foos:List[Foo]):NodeSeq = { <span id="go"><table> { for {foo <- foos} yield <tr><td>{foo.getValue}</td></tr> } </table></span> } def render = { bind("foo" -> createDisplay(foos)) } override def localSetup = { println("........ localSetup: " ) super.localSetup this ! Tick } override def lowPriority = { case Tick => { println(".... Tick ....") foos = FooManager.getFoos reRender(false) ActorPing.schedule(this, Tick, 10 seconds) } } } case object Tick ### When i run mvn jetty:run to start the server, and type the http://localhost:8080 in the browser. The result will be like this, the println(".... Tick ....") method only execute 1 time every 10 seconds. ### INFO - Service request (GET) /comet_request/50054201120/farmqqw03xkm took 46 Mil liseconds .... Tick .... ........ foos size: 2 INFO - Service request (GET) /comet_request/87077494133/farmqqw03xkm took 8625 M ### Then i don't close the browser, and Ctrl+C stop the jetty server, and mvn jetty:run restart the server, the result will be like this: The println(".... Tick ....") method will be execute 3 times every 10 seconds. ### INFO - Service request (GET) /comet_request/74875169086/farmqqw03xkm took 0 Mill iseconds ........ foos size: 8 ........ localSetup: .... Tick .... ........ foos size: 9 INFO - Service request (GET) / took 109 Milliseconds ........ foos size: 10 ........ localSetup: .... Tick .... ........ foos size: 11 INFO - Service request (GET) / took 31 Milliseconds ### I don't know what's wrong with it . If when you stop the server, and close the browser immediately, then use mvn jetty:run to start the server, and open a new browser to visit http://localhost:8080, the result is correctly. Thanks for any suggestion! Cheers, Neil -- You received this message because you are subscribed to the Google Groups "Lift" group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.