lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Hi!

I've spent a few hours trying to grok luasocket, and
I think I originally over-estimated the capabilities
of its bundled http module.

My goal is to receive content over HTTP without
unavoidably blocking the app at all.

I thought this'd be possible with luasocket's http
module, but, although luasocket's sockets do seem to
offer a nonblocking mode, the http module doesn't offer
any facility for making use of this (except crudely
aborting a transaction if it times-out too long).

Would it be a better idea for the higher-level code
to decide whether to schedule a retry of its last
operation (open, read, write) upon blocking, with a
tiny/zero timeout?  It could still monitor
the real-time elapsed without successful operation,
and only throw an exception when this time passes
an uber-timeout threshold.

Maybe that's what the magic of ltn12 attempts to achieve
behind the scenes, but if so then I'd like guidance on
how to write a non-blocking proxy source that'd achieve
the above, that I can somehow pass into http.request and
have everything work out nicely!

Thanks,
--Adam