Skip to content

Listening

app:listen hands the socket to the Rust core and blocks the Lua thread.

app:listen(3000) -- blocks; defaults to 3000 when omitted
app:listen(3000, function() -- callback runs once the port is bound,
print("Ready!") -- before any request is served
end)

Ludi prints nothing on startup — logging is the application’s choice, in the callback:

app:listen(3000, function()
print("Listening on http://localhost:3000")
end)
local ok, err = pcall(function()
app:listen(80)
end)
if not ok then
print("failed to bind: " .. err)
end