Back to News
Advertisement

Show HN: Lightspeed, build real time apps the Laravel way (+asteroids demo)

jjv22222 about 8 hours ago 2 comments

ZH version is available. Content is displayed in original English for accuracy.

Hi HN!

Laravel has worked with websockets for years but generally speaking it's a one way push architecture (i.e. http in, sockets out).

Lightspeed is kind of like node in that it's a single server that serves your http and your websockets all under one roof. Auth runs in 0.03ms (a Redis read, no database). Your Laravel handler runs inside the full container and the reply comes back down the same socket. I think this could be really cool for creating new ways of working with Laravel.

Anyway, I put together a live demo to show it in action. Basically a cross between slither.io and Asteroids.

Game here:

https://innerloop.works/lightspeed

Repo here:

https://github.com/innerloop-dev/lightspeed

Note: This is 0.1.0, the API may change before 1.0. It needs the Swoole extension and Redis. MIT.

Advertisement

⚡ Community Insights

Discussion Sentiment

50% Positive

Analyzed from 99 words in the discussion.

Trending Topics

#livewire#lightspeed#server#laravel#http#doesn#echo#relate#build#form

Discussion (2 Comments)Read Original on HackerNews

AlchemistCampabout 7 hours ago
How does this relate to Laravel LiveWire?
jv22222about 7 hours ago
It doesn't! Livewire is a way to build UI/form interactions over http/js.

Lightspeed is a websocket server.

Livewire talks to the server over normal HTTP requests and for anything pushed from the server it uses Laravel Echo. Lightspeed is a Pusher-compatible server so you'd point Echo at it like you would Reverb.

The thing Lightspeed adds is letting the browser send messages back into Laravel over that same socket, with auth on each one. Livewire doesn't do that its actions are still HTTP.

For most applications Livewire would be the goto. Lightspeed is kind of a high speed specialist option for building real time apps like you might do with node.js for exmaple.