Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
andersmurphy
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
25 ms
·
451.
▲
by
andersmurphy
1y ago
It's deliberately naive. But brotli and a tuned compression window over SSE means it gets 150-250:1 compression ratio, combined with Datastar rendering speed and you can get away with it. The reason it's naive is although you can
452.
▲
by
andersmurphy
1y ago
So I've used Turbo 8 to make a multiplayer app using a non rails backend. It was a struggle, the docs are incomplete. I mostly pieced things together from what others have done and written about. Which, is ironic considering your point
453.
▲
by
andersmurphy
1y ago
If you want a solid demo of what you can do with datastar. You can checkout this naive multiplayer game of life I wrote earlier in the week. Sends down 2500 divs every 200ms to all connected cliends via compressed SSE. https://ex
454.
▲
by
andersmurphy
1y ago
In my experience it reconnects faster and more reliably than web sockets. Also nothing is stopping you telling the user the connection is down/retrying etc.
455.
▲
by
andersmurphy
1y ago
There's is not final download it's a streaming game. It's live multiplayer. The initial bundle is 12kb (datastar + initial html + css). What you are seeing is the constant SSE connection streaming compressed data. Are you beh
456.
▲
by
andersmurphy
1y ago
It's embedded in an iframe on the blog, you can always try example.andersmurphy.com to access the game directly.
457.
▲
by
andersmurphy
1y ago
Oh and something I forgot to mention in the blog post. - The server is in Europe. - The process can be modified at the REPL while It's running (and the changes get pushed out to all users by the SSE). So the board, HTML, CSS etc can al
458.
▲
by
andersmurphy
1y ago
Also because of the compression being used the game runs fine on 3G connections.
459.
▲
by
andersmurphy
1y ago
Basically. It's generating the html for the game state every 200ms (regardless of the number of connected users) and pushing it down to any connected clients via SSE. The magic is Brtoli + SSE + a properly sized context window means it
460.
▲
by
andersmurphy
1y ago
I'd also add even if for whatever reason you are on http1.1 (you should really use http2 for server driven apps there's a lot of other advantages). Datastar prunes connection based on the browser visibility API so on http1.1 a use
461.
▲
by
andersmurphy
1y ago
Author of the blog post here. Happy to answer any question!
462.
▲
by
andersmurphy
2y ago
+1 for recommending data-star. The combination of idiomorph (thank you), SSE and signals is fantastic for making push based and/or multiplayer hypermedia apps.
463.
▲
Clojure: Structured Concurrency and Scoped Values
(andersmurphy.com)
2 points
by
andersmurphy
2y ago
|
0 comments
464.
▲
by
andersmurphy
2y ago
Thank you for the explanation and for all the hard work on bringing virtual threads to the JVM. It's a really awesome feature.
465.
▲
by
andersmurphy
2y ago
I mention that article at the bottom of the blog post. It's a really good overview!
466.
▲
by
andersmurphy
2y ago
(author here) Virtual threads being "free" definitely makes things simpler to implement, I was actually quite surprised. Where I think things would get more complicated is if you wanted to control how bursty the token bucket is. Y
467.
▲
by
andersmurphy
2y ago
(author here) From what I've read, other than documentation saying they shouldn't be pooled, is that by disign they are meant to run and then get garbage collected. There's also some overhead in managing the pool. If someone
468.
▲
by
andersmurphy
8y ago
Great article! I had a similar revelation with Lisp and Clojure. Writing in a language you enjoy using and are very productive in (effort->effect) is really liberating. The great thing is even when I have to return to the old ways (Java)