Closed diyism closed 2 years ago
Although there's another async method:
<html>
<body>
<?lsp
response:write("Hello World<br/>")
local function q()
local http=require"httpc".create()
http:request{method="GET",
url="https://a web page of very long content"
}
local data,err=http:read"*a"
os.execute("/usr/bin/sudo /home/malcolm/lcus1.sh")
end
ba.timer(q):set(0)
?>
</body>
</html>
Mako seb server is very slim and strong.
In mako, you would do the following to end the response (you defer the execution of the http client): ba.thread.run(function() local http=require"httpc".create() http:request{method="GET", url="https://a web page of very long content"} local data,err=http:read"*a" end)
In nginx-lua/openresty, I can close the http response early (avoid my users waiting) and continue doing things that cost time on my server:
Does the Mako web server have such an API? for example: response:eof()