question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Reloading like Play

See original GitHub issue

I see the following related issues:

However from my experience with sbt-revolver that’s not quite what Play offers.

In development mode, Play starts a server for you, before the sources are even compiled. Only once you hit the server via the web browser, does it compile and start up the application. Likewise, a source code change does not trigger a restart. Once sources are changed, AND you reload, that’s when the recompilation happens.

I continue to use Play despite having http4s and akka-http available because I don’t enjoy the reloading cycle using eager compilation. Why? I save the sources, Alt-Tab to the browser, refresh, and… bam! “Could not connect to the server”. So you then have to line up with the compiler in terms of waiting times, until you can finally Refresh the page.

With Play, you save the code, Alt-Tab, Refresh, and just wait for your page to load. Lower cognitive load, much more pleasant to deal with.

So I’d like to keep this issue open, based on the understanding that the others have not answered the question exactly. Play starts a server in background and recompiles on demand.

While I am all for libraries, this one thing that is enforced by the fact that Play is a framework makes it an absolute delight to use, despite its non-uniform non-FP nature.


I’m even wondering if it’s possible to embed an http4s route in Play. That’d provide an incremental adoption from Play crowd of http4s - instead of having to throw away all your Play code in one big go. Try with one endpoint, then two, and eventually all.


--- (Running the application, auto-reloading is enabled) ---

[info] p.c.s.AkkaHttpServer - Listening for HTTP on /0:0:0:0:0:0:0:0:9000

(Server started, use Enter to stop and go back to the console...)

[info] Compiling 1 Scala source to /.../target/scala-2.12/classes ...
[info] Done compiling.
[info] play.api.Play - Application started (Dev)
[info] Compiling 1 Scala source to /.../target/scala-2.12/classes ...
[info] Done compiling.

--- (RELOAD) ---

[info] play.api.Play - Application started (Dev)

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
ScalaWilliamcommented, Apr 5, 2021

For anyone interested, while this issue has not gone away by itself, I found a much happier solution; sbt-revolver + browser-sync.

I wrote a small http4s plug-in for browser-sync. It’s not documented very much, but if anybody is interested,

libraryDependencies += "com.scalawilliam.rad4s" %% "http4s-browsersync" % "0.60.2-SNAPSHOT"

Sources @ https://github.com/ScalaWilliam/rad4s/blob/master/http4s-browsersync/src/main/scala/com/scalawilliam/rad4s/BrowserSync.scala

This would reStart the app, and then reload your browser window once it’s started up.

2reactions
ritschwummcommented, Apr 28, 2018

funny, that’s the one thing where i very much prefer using sbt-revolver over what play does - change some code, switch to the browser, hit reload - and instead of of just giving me the page, it lets me wait for ages until it finally finished compiling it 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Reloading Everyday Stuff Like Video Game Weapons Is ...
Reloading Everyday Stuff Like Video Game Weapons Is Immensely Satisfying. Anybody who says they haven't done at home this is a liar.
Read more >
Watch a Dude Reload Household Objects Like Video Game ...
These video game reload recreations may be the most satisfying videos you watch all day.
Read more >
Just a guy reloading household objects like video game ...
Karl "Kommander Karl" Schecht is reloading toasters, lamps, and smoke alarms like he's in a video game.
Read more >
Random: This Guy Can Reload Anything Like A Gun In An ...
The media could not be played. Reload. 6:17 AM ...
Read more >
All-or-Nothing Reloads - TV Tropes
The All-or-Nothing Reloads trope as used in popular culture. ... rather than letting the bolt-cycle animation play out), as most weapons have a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found