object Comet
Helper function to produce a Comet using Akka Streams.
Please see https://en.wikipedia.org/wiki/Comet_(programming) for details of Comet.
Example:
def streamClock() = Action { val df: DateTimeFormatter = DateTimeFormatter.ofPattern("HH mm ss") val tickSource = Source.tick(0 millis, 100 millis, "TICK") val source = tickSource.map((tick) => df.format(ZonedDateTime.now())) Ok.chunked(source via Comet.flow("parent.clockChanged")) }
- Source
- Comet.scala
- Alphabetic
- By Inheritance
- Comet
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
clone(): AnyRef
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @native() @throws( ... )
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
finalize(): Unit
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
def
flow(callbackName: String, initialChunk: ByteString = initialByteString): Flow[ByteString, ByteString, NotUsed]
Creates a flow of ByteString.
Creates a flow of ByteString. Useful when you have objects that are not JSON or String where you may have to do your own conversion.
Usage example:
val htmlStream: Source[ByteString, ByteString, NotUsed] = Flow[Html].map { html => ByteString.fromString(html.toString()) } ... Ok.chunked(htmlStream via Comet.flow("parent.clockChanged"))
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- val initialByteString: ByteString
- val initialHtmlChunk: Html
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
def
json(callbackName: String): Flow[JsValue, ByteString, NotUsed]
Produces a flow of ByteString using
Json.fromJson(_).get
from a Flow of JsValue.Produces a flow of ByteString using
Json.fromJson(_).get
from a Flow of JsValue. Calls out to Comet.flow internally.- callbackName
the javascript callback method.
- returns
a flow of ByteString elements.
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
def
string(callbackName: String): Flow[String, ByteString, NotUsed]
Produces a Flow of escaped ByteString from a series of String elements.
Produces a Flow of escaped ByteString from a series of String elements. Calls out to Comet.flow internally.
- callbackName
the javascript callback method.
- returns
a flow of ByteString elements.
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toString(): String
- Definition Classes
- AnyRef → Any
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @throws( ... )