|
| ▲ | rpdillon a day ago | parent | next [-] |
| This is exactly the sort of thing I'm really interested in. I'm particularly excited about various takes on Lua+batteries, have looked into designing my own (C wrapper with bindings to networking, JSON, templating, and DB libraries), but found Redbean to be almost ideal so never got past overall design to dig into code. Turbo looks fantastic, though! It's precisely the niche I was looking to have filled, so I'll build a prototype or two in it to see what I think. Very much appreciate the pointer! |
| |
| ▲ | MomsAVoxell a day ago | parent [-] | | You’re welcome - we share interests, I too am interested in the Lua+batteries approach to life - I’ve used Lua very successfully in many commercial projects, so I’m quite convinced of its power in spite of the warts and thorns that many newbies in the ways of Lua tend to whine about. TurboLua is particularly great because it really integrates about all of the I/O mechanisms you could want in a network-centric application, plus it has a pretty nice runtime loop which is easy to hook into and coordinate properly with signal handlers and fd sets and things. Can’t beat it as a very quick way to do embedded stuff too - very easy to do gpio, signal handling, etc. Good luck, if you have time to share your thoughts after an initial first-pass, I’d be happy to hear your perspective .. |
|
|
| ▲ | Bluestein 21 hours ago | parent | prev | next [-] |
| > limited-resource systems (512 megs of RAM) .. I am offended on behalf of all for whom that is more RAM than their first computer had :) |
| |
| ▲ | BobbyTables2 20 hours ago | parent | next [-] | | Having a computer with 256MB of RAM was once my dream … Seemed like a lot when I only had 2MB… | | |
| ▲ | Bluestein 16 hours ago | parent [-] | | What was that Gates quote again? (No. Not the one from his latest, AI-oriented diatribe ...) | | |
| ▲ | strawhatguy 3 hours ago | parent [-] | | 64KiB is all anyone needs, wasn’t it? | | |
| ▲ | Bluestein 3 hours ago | parent [-] | | That's it :) PS I do seem to remember it was either disavowed or inexact. Notwithstanding, it is a bit like Twain or Einstein, they get stuck with things that they could reasonably indeed have said.- |
|
|
| |
| ▲ | MomsAVoxell 18 hours ago | parent | prev [-] | | Yes, I know. I learned to program on a system with 64k, which was only fully available if one used assembly. 512 megs is not a lot for an embedded Linux project these days, but it can do a lot. Especially if you use Lua. ;) |
|
|
| ▲ | JSR_FDED 19 hours ago | parent | prev | next [-] |
| Fantastic, thanks. I love Lua and especially the mindset that goes along with it. Will definitely check this out. Combining it with Datastar could be brilliant - I wonder if TurboLua supports SSE streaming. |
| |
| ▲ | MomsAVoxell 18 hours ago | parent [-] | | All the basics are there (chunked mode), I think you’d only need to do some thing things: local SSEHandler = class("SSEHandler", turbo.web.RequestHandler)
function SSEHandler:get()
self:set_async(true)
self:set_header("Content-Type", "text/event-stream")
self:set_header("Cache-Control", "no-cache")
self:set_chunked_write()
-- first event
self:write("data: hello\n\n")
self:flush()
-- later events via IOLoop
local ioloop = turbo.ioloop.instance()
local count = 0
local timer
timer = ioloop:add_timeout(1000, function()
count = count + 1
self:write(string.format("data: tick %d\n\n", count))
self:flush()
if count < 10 then
timer = ioloop:add_timeout(1000, timer) -- reschedule
else
self:finish()
end
end)
end
|
|
|
| ▲ | mathnode 17 hours ago | parent | prev [-] |
| This is the first I am hearing about turbo lua, very cool! I was aware of openresty but I still resorted to flask for quick endpoints or concepts. This changes things for me. |