Play Framework & SF Scala: Jim Brikman, Composable Applications in Play, 7/23/14

FunctionalTV · 16K views · 2014 · 1:11:41

Open on YouTube

Web developmentFunctional programmingSoftware architecture & designtalkdated

Why Stack Overflow recommends it

Stack Overflow users link it as the reference guide when building composable, streamed pages in Play Framework, often noting that its code predates Play 2.5 and needs porting.

Recommended by 1 people across 1 different months, 2015 to 2017.

What it is

A 2014 SF Scala meetup talk by Jim Brikman (hosted at Nitro) showing how to build the equivalent of Facebook's BigPipe in the Play Framework. Page components are rendered and delivered in parallel to cut latency, especially on mobile, and the talk walks through composing Play actions and streaming responses.

What people said

Recommends jesus g_force Harris · 2017-06 · Stack Overflow · on “Cannot connect to localhost with cURL on Command Prompt”

He doesn't dp that on the vid [this video] I mentioned. I clearly don't have any idea how to do that or what exactly I am doing here. Could you suggest any references for doing this? thanks

Cites Cristian Garcia · 2015-03 · Stack Overflow · on “Streaming text in Dart with Redstone/Shelf”

It just occurred to me that it would make sense to stream strings, each representing an element from a database query instead of returning the whole list of them at the end of the process, this might get the first result earlier on the browser. So I tried to implement this with Redstone which uses Shelf . Here is my basic test @app.Route ('/testStream') testSream () { StreamController<String> controller = new StreamController<String> (); () async { var initialTime = new DateTime.now(); await new Future.delayed (new Duration (seconds: 1)); controller.add("hello\n"); await new Future.delayed (new Duration (seconds: 10)); controller.add("chao\n"); var finalTime = new DateTime.now().difference(i

Cites XaolingBao · 2016-05 · Stack Overflow · on “Concept of promises in Java”

UPDATE 7/20/17 I wanted to edit that there is also a Library called "ReactFX" which is supposed to be JavaFX as a reactive framework. There are many Reactive Java libraries from what I've seen, and since Play is based on the Reactive principal, I would assume that these Reactive libraries follow that same principal of non-blocking i/o, async calls from server to client and back while having communication be send by either end. These libraries seem to be made for the client side of things, but there might be a Server reactive library as well, but I would assume that it would be wiser to use Play! with one of these client side reactive libraries. You can take a look at [LINK] which implements

Cites jesus g_force Harris · 2017-05 · Stack Overflow · on “Stream Future in Play 2.5”

Once again I am attempting to update some pre Play 2.5 code (based on this vid [this video] ). For example the following used to be how to stream a Future : Ok.chunked(Enumerator.generateM(Promise.timeout(Some("hello"), 500))) I have created the following method for the work-around for Promise.timeout (deprecated) using Akka : private def keepResponding(data: String, delay: FiniteDuration, interval: FiniteDuration): Future[Result] = { val promise: Promise[Result] = Promise[Result]() actorSystem.scheduler.schedule(delay, interval) { promise.success(Ok(data)) } promise.future } According to the Play Framework Migration Guide [LINK] ; Enumerators should be rewritten to a Source and Source.unfoldAsyn

Cites jesus g_force Harris · 2017-05 · Stack Overflow · on “Composing and outputting two future asynchronous actions on screen”

I hate to ask - I really do but this one has got me for the moment.. I'm trying to compose some actions (in Play Framework & scala ) with my main guide being this vid [this video] . However it was made a few years back so some of the functionality has since been deprecated and therefore I have had to find work-arounds as I go. Currently I am trying to output two asynchronous actions within some HTML markup. I successfully outputted one action with this controller: package controllers import akka.actor.ActorSystem import javax.inject._ import play.api.mvc._ import services.ServiceClient import scala.concurrent.ExecutionContext @Singleton class AsyncController @Inject() (sc: ServiceClient)(actorSys

Cites jesus g_force Harris · 2017-07 · Stack Overflow · on “Creating a custom template format in Play 2.5”

I'm trying to make a custom template format (in Play 2.5_ & _Scala 2.11.11 ) by following the Play documentation [LINK] but I'm here so that means it's not working out for me. I want the new template to have a file extension of " stream " (as in this video [this video] which is a few years old now) so I created this file as the documentation suggests: package ui import akka.NotUsed import akka.stream.scaladsl.{Source} import play.twirl.api._ import scala.collection.immutable case class HtmlStream(source: Source[Html, NotUsed]) extends Appendable[HtmlStream] { def +=(other: HtmlStream): HtmlStream = andThen(other) def andThen(other: HtmlStream): HtmlStream = HtmlStream(source.merge(other.source))