Hello community,
I need my http request to be asynchronous.
From what I’ve gathered, the Corona SDK does not support that in a way that allows me to read the response body and all the response headers.
What I did is write my own Http-Client based on lua sockets. It supports cookies, chunked as well as “unchunked” transfer encoding and connection keep-alive.
Also, it runs asynchronously as a coroutine, meaning that starting an HTTP request is a non blocking action. Once the request is completed, a request-specific callback-function is executed.
It would serve my purpose perfectly. Problem is performance. For unknown reasons, it seems to have much slower response times (time of sending the request to time of having completely received the response) than the synchronous version of the Corona SDK.
Is this just unavoidable, seeing that the SDK-implementation is native while my implementation is Lua? If yes, are there any alternatives, maybe an asynchronous Http-Request that comes with the SDK and provides response body as well as headers that I have overlooked?
If not, any ideas why response times are so slow even though the framerate (frames include the socket.select(…)-call that should tell me immediately if there is data to receive) is high?
Thanks
[import]uid: 107577 topic_id: 19069 reply_id: 319069[/import]