Settings

Theme

Show HN: Undead – scary fast, bewitching web pages on the JVM with no JavaScript

github.com

14 points by floodfx 2 years ago · 7 comments · 1 min read

Reader

Hey HN. I wrote a LiveView implementation for the JVM called Undead. (The name Undead is a play on the "Live" part of LiveViews.)

I had been waiting for the new StringTemplates feature of Java 21 which made it scary-easy to get the right data structures to make things work.

It's been enchanting to write Java after about ten years in Javascript and Go lands. Would love folks to try it out and lmk what you think. If you aren't too scared that is. ;)

exabrial 2 years ago

First thing, this is wicked cool.

I've never heard of LiveViews before, but honestly this is what I think we've been looking for... treat the browser just as a rendering engine, keep your codebase on the server.

I'm curious if the protocol could be implemented on Quarkus, or preferably Tomcat or TomEE... one thing we've come to love in recent years is CDI. It just make writing large applications very easy because they can all be broken down into simple parts and tested individually using Mockito. I could imagine all sorts of cool CDI extensions with this... an 'EventScoped' bean and CDI Events would fit right into the whole concept.

Can you explain a little more about what's happening? Watching the network inspector, it looks like the browser is relaying events back to the server over a websocket (as you said). After that, what's happening on the server side? Somehow it arrives at a diff command for the client. Curious what's happening to calculate the diff!

  • brunoborges 2 years ago

    You should check out JPro. It is a JavaFX-based technology where the JavaFX (desktop framework) is rendered in the browser using Web stack technologies. The entire state of the app is maintained server-side, even on a per-user basis. JFX Central is implemented like that:

    https://www.jfx-central.com/

    The code base is actually a desktop application written in JavaFX, where the browser just happens to be a "monitor screen" showing you the desktop app.

    As for server-side state and server-side rendered UI, many other Java frameworks have implemented similar techniques, including but not limited to: JSF, Apache Wicket, Vaadin, etc.

    I am not sure this project is truly innovating here, with things like:

        HTML."""
          <div>Hello</div>
        """;
Tagbert 2 years ago

Curious. What is "LiveView"? Web searches return likely unrelated terms.

What is the use case for this project:

  • floodfxOP 2 years ago

    The link that @helb sent is a good summary from the Phoenix docs but it is sort of hard to "get" just by reading about it. My attempt to be more concise is "a LiveView is a server process that receives events (clicks, form input, etc) from the browser, updates its state on the server, and sends back diffs which are applied to the browser."

    You can think about it as a server-rendered HTML page that gets updated via Websocket updates.

    That doesn't really do it justice either. I think writing a little bit of code and running a LiveView server is probably the best way to truly grok it.

    Like any new paradigm, it takes a bit of a mind shift to see the value.

    If you can, try running the Undead example server by downloading the repo and running:

    `mvn package exec:exec`

  • helb 2 years ago

Keyboard Shortcuts

j
Next item
k
Previous item
o / Enter
Open selected item
?
Show this help
Esc
Close modal / clear selection