-
-
Notifications
You must be signed in to change notification settings - Fork 549
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #662 from ihostage/fix-play-scala-streaming-example
Fix `play-scala-streaming-example`
- Loading branch information
Showing
8 changed files
with
25 additions
and
17 deletions.
There are no files selected for viewing
5 changes: 2 additions & 3 deletions
5
play-scala-streaming-example/app/controllers/HomeController.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 7 additions & 6 deletions
13
play-scala-streaming-example/app/controllers/ScalaCometController.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,22 @@ | ||
package controllers | ||
|
||
import javax.inject.{Inject, Singleton} | ||
|
||
import org.apache.pekko.stream.Materializer | ||
import play.api.http.ContentTypes | ||
import play.api.libs.Comet | ||
import play.api.mvc._ | ||
import views.html.helper.CSPNonce | ||
|
||
import javax.inject.{Inject, Singleton} | ||
|
||
@Singleton | ||
class ScalaCometController @Inject() (cc: ControllerComponents, materializer: Materializer) extends AbstractController(cc) | ||
class ScalaCometController @Inject()(cc: ControllerComponents, materializer: Materializer) extends AbstractController(cc) | ||
with ScalaTicker { | ||
|
||
def index() = Action { | ||
def index(): Action[AnyContent] = Action { implicit request => | ||
Ok(views.html.scalacomet()) | ||
} | ||
|
||
def streamClock() = Action { | ||
Ok.chunked(stringSource via Comet.string("parent.clockChanged")).as(ContentTypes.HTML) | ||
def streamClock(): Action[AnyContent] = Action { implicit request => | ||
Ok.chunked(stringSource.via(Comet.string("parent.clockChanged", CSPNonce()))).as(ContentTypes.HTML) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
@() | ||
@()(implicit request: RequestHeader) | ||
|
||
@main { | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters