Closed soumith closed 9 years ago
I like the idea. Do you know a good lua package providing lightweight HTTP response building?
luasocket which seems to have become the de-facto socket library used in lua, seems to have a http request/response builders: http://w3.impa.br/~diego/software/luasocket/http.html , and probably is the simplest way forward.
I couldn't find http response building in luasocket. It wouldn't be difficult to add. On the other hand, I think Turbo or Async would do.
https://github.com/szym/display/commit/ad5769e72a943b64ff7e195c2a4d14a69620e5b0 adds server.lua which is a TurboLua based event forwarder.
There's a bug in TurboLua's recv buffer throttling kernelsauce/turbo#232 but there's an easy workaround (https://github.com/szym/display/commit/488857a3ddb2919b8fee88142b650db377a1c773).
Let me know if that works.
BTW, I've had some issues with installing TurboLua using torch's luarocks because it's Makefile wants to install to /usr/local
by default. The workaround there is PREFIX=~/torch/install luarocks install turbo
.
thanks. I've tried to install turbo on a variety of systems, and the first FAIL moment I've had (for which I apologize) is that Turbo is Linux Only. That would make it not suitable for a general audience.
I am working right now on a pure luasocket based forwarder, should send a PR in the next couple of hours.
Looking at Turbo's Makefile and kernelsauce/turbo#201, it should also support Mac (Darwin), although the rockspec was not yet updated to reflect that. Turbo's only non-Lua code is the HTTP parser :-/
I'm still a bit hesitant on Turbo Lua (considering that I'll be answering random people's questions on the forums about install issues). There's two things that make me hesitate: (1) this statement in the readme: "LuaJIT 2 is REQUIRED, PUC-RIO Lua is unsupported." (2) dependency on libssl (it's been generating quite a few questions on OSX)
As you might have seen in the ROADMAP, we are planning to support LuaJIT as well as Lua51/Lua52, so it goes against what we require.
I made some headway via async (https://github.com/clementfarabet/async) who's only dependency seems to be lua-cjson, and everything is included in it. any hesitation to use that?
If one needs even more minimalism (which I think might be not a bad idea), I'm willing to spend some time to embed lhttp_parser into your repo, and make display have absolutely no external dependencies except luasocket (either C libraries, or lua modules)
LuaSocket's http parser is good enough, and we could add a rudimentary http 1.1 writer. Is this what you're up to right now?
indeed. that's exactly what I'm up to at the moment.
Great! Waiting for the PR.
I took a closer look at clementfarabet/async and it would work (http.listen is all that's needed). Let me know if you want to depend on it. It'd probably need a different name to not be confused with https://luarocks.org/modules/bartbes/async (luarocks.org incorrectly shows that waffle depends on that async).
I'll update the rockspec to just place the lua and static files where they need to be.
Ok, so this should be all done after clementfarabet/async#22 is merged.
Hi,
as you saw, we are thinking of extending "display" a bit more, pimping it out with essential features, and making it a much more polished display backend that we can recommend to everyone in the Torch ecosystem.
On that note, gfx.js, itorch and display suffer from having nodejs/ipython dependency, with quite a few users having trouble installing these.
What are your views on making the json forwarder purely as a lua server?