[LIB] [akifox-asynchttp] Asynchronous HTTP Requests

I was having trouble with URLLoader on CPP targets freezing for half a second my app. (not every time but often, and especially when in presence of a slow connection)

So I’ve written a library that handle the HTTP Requests (now it is functional mostly for text-based requests, as HTML, Json, XML and so on).

It features HTTP/1.0 and HTTP/1.1 support (REST methods and chunked responses).
It is fully asynchronous using multi-threading on supported platforms (neko, cpp and java).
All the other platforms fallback on the standard URLLoader.

(It can be used without OpenFL removing the small references and substituting them with the haxe flash relatives)

You can see the library here

And if you want to use it or test it you can install it from haxelib

haxelib install akifox-asynchttp

Also, I am adding support to automatic response parsing based on the content-type.
Json it is already implemented although not automatic.

See ya


I’ve been working a bit on the library and I am releasing a new version
The improvements are huge.

you can get it on haxelib as usual

What’s new (0.2 to 0.3) [breaking API]

  • The library doesn’t rely on OpenFL anymore and it is a pure Haxe library!
  • Flash target use the default URLLoader (async)
  • Javascript target use the default Haxe.Http (async XmlHttpRequest)
  • The content (both on request and response) is now fully functional.
  • The library is now thread-safe (major problems in 0.2)
  • Support for redirection (HTTP STATUS 30x)
  • Using sockets make requests around 50% faster than OpenFL URLLoader

There is just a small part of the library which use OpenFL to display a bitmap loaded via HTTP asynchronously.
Here is the example https://github.com/yupswing/akifox-asynchttp/tree/master/samples/openfl

You can see the documentation on the main README.md here

See ya

1 Like

Just wanted to say great work, this looks fantastic. Will be testing it out soon :smile:

Thank you :wink:

There have been some updates since this posts, mainly SSL support, some refactoring and more control over the request. (here’s the post)
If you have any problem please report it on the issues tracker


1 Like

Great work first of all.

I’m having some problems when i have to communicate with a webservice and have to pass parameters to a specific method. Do you have any example where I can study?
Does the communication has to be in Rest?


sorry for the late answer…

You can specify any of the 4 basic verbs (GET, POST, PUT, DELETE) in the request and communicate with a restful service.

Remember this is NOT supported in FLASH target.