#1852 Async Http client for Fantom

kaushik Fri 23 Mar 2012

I need some async http client for accessing dropbox api, so I started with this:

https://bitbucket.org/ksat/asynchttp/wiki/Home

Apis are based on dom:HttpReq and dom::HttpRes. Internally uses Async http client for Java

Eg.,

Http:

HttpReq(`https://www.google.com`).get |res|{
    echo(res.content)
}

Https/postform:

HttpReq{uri=`http://www.google.com`; async = false}.postForm(["a":"b"]) |res|{
    echo(res.content)
}

oauth:

HttpReq{
    uri=`http://www.google.com`; 
    async = false
    oauth = OAuth{
        consumerKey = ""
        consumerSecret = ""
        tokenKey = ""
        tokenSecret = ""
    }
}.get|res|{
    echo(res.content)
}

Xan Sat 24 Mar 2012

Can you put benchmarks here compared with built-in client with actors? (for example with darkhttp as localhost web server for not counting bandwith)

Thanks a lot for your contribution. Async client is one of the features I missing in Fantom

Xan.

dobesv Sun 25 Mar 2012

I also would be curious as to why you need it to be asynchronous instead of synchronous as I'm kind of puzzling over the value prop of asynchronous I/O these days.

Akcelisto Thu 13 Sep 2012

I try to compile:

compile [asynchttp]
  Compile [asynchttp]
    FindSourceFiles [3 files]
    WritePod [file:/D:/Programs/fan/lib/fan/asynchttp.pod]
  javaNative [asynchttp]
    Exec [C:\Program Files (x86)\Java\jdk1.7.0_03\bin\java.exe -cp D:\Programs\fan\lib\java\sys.jar -Dfan.home=D:\Programs\fan fanx.tools.Jstub -d R:\sites\-other\asynchttp\temp-java asynchttp]
    Java Stub [asynchttp]
    CompileJava
javac: target release 1.5 conflicts with default source release 1.7
ERR: CompileJava failed
BUILD FAILED [2564ms]!

brian Thu 13 Sep 2012

That sounds related to 1765

Login or Signup to reply.