[luci] luci Digest, Vol 51, Issue 4

Bryan Mayland bmayland at leoninedev.com
Fri Aug 10 14:55:24 CEST 2012


Yes, look at that link I had in my reply that makes a synchronous 
request to facebook and parses the JSON returned. You can't make an 
async call from LuCI to generate a page because the page can't be sent 
until you get your data back anyway. If you really wanted to do it 
asynchronously, you could have the request spawn a new process that 
actually does the work (using nixio.fork() or some form of exec), but 
the web request from the client would return immediately.

On 8/10/2012 6:53 AM, Duy Nguyen wrote:
> Oh hi Bryan Mayland, thanks so much for your reply!!
>
> My issue is I want to asynchronously make a request to facebook API to 
> get a response from it. The URL for the request is like this: 
> https://graph.facebook.com/me?access_token=[access_token]. I would 
> like to get the response from Facebook for that request. It is because 
> I want to use this response for further processing. In Javascript I 
> could do this by using JSONP to make the request and then use a 
> callback function to catch the response. But in LuCI, I don't know how 
> to write this kind of code.
>
> Do you know how to deal with that?
>
> Thank you in advance!
> Best regards,
> Duy Nguyen.
>
>
> On Fri, Aug 10, 2012 at 5:00 PM, <luci-request at lists.subsignal.org 
> <mailto:luci-request at lists.subsignal.org>> wrote:
>
>     Send luci mailing list submissions to
>     luci at lists.subsignal.org <mailto:luci at lists.subsignal.org>
>
>     To subscribe or unsubscribe via the World Wide Web, visit
>     https://lists.subsignal.org/mailman/listinfo/luci
>     or, via email, send a message with subject or body 'help' to
>     luci-request at lists.subsignal.org
>     <mailto:luci-request at lists.subsignal.org>
>
>     You can reach the person managing the list at
>     luci-owner at lists.subsignal.org <mailto:luci-owner at lists.subsignal.org>
>
>     When replying, please edit your Subject line so it is more specific
>     than "Re: Contents of luci digest..."
>
>
>     Today's Topics:
>
>        1. Re: How to make a request and catch its response (in JSON
>           format)? (Bryan Mayland)
>
>
>     ----------------------------------------------------------------------
>
>     Message: 1
>     Date: Thu, 09 Aug 2012 09:30:51 -0400
>     From: Bryan Mayland <bmayland at leoninedev.com
>     <mailto:bmayland at leoninedev.com>>
>     To: luci at lists.subsignal.org <mailto:luci at lists.subsignal.org>
>     Subject: Re: [luci] How to make a request and catch its response (in
>             JSON format)?
>     Message-ID: <5023BB8B.7060305 at leoninedev.com
>     <mailto:5023BB8B.7060305 at leoninedev.com>>
>     Content-Type: text/plain; charset=ISO-8859-1; format=flowed
>
>     On 8/9/2012 4:13 AM, Duy Nguyen wrote:
>     > I am now stuck in using LuCi API to write a controller to make a
>     > request to a certain page asynchronously, and then catch its
>     response
>     > (in JSON format) for further processing.
>     >
>     > I am a very newbie to LuCi so I really need help.
>     >
>     > Hope that there will be someone who knows how to deal with my
>     problem.
>     You can find several examples of doing synchronous JSON requesting and
>     parsin by googling "luci require httpclient", but if you need to do it
>     asynchronously you'll need to tell us when exactly you're trying to do
>     what. Asynchronous to what?
>
>     Here are some good examples of synchronous JSON from the fonera folks:
>     http://svn.fonosfera.org/fon-ng/trunk/luci/libs/uploadd/luasrc/fon/facebook.lua
>     http://svn.fonosfera.org/fon-ng/trunk/luci/applications/luci-torrent/luasrc/transmission.lua
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.subsignal.org/pipermail/luci/attachments/20120810/ac6fefee/attachment.html>


More information about the luci mailing list