Posted on by

Starting with build 2013.1043, on iOS, Android, Mac and Windows, we are rolling out new functionality within our network api. Network functions like download, request have been enhanced with new functionality. Check out our daily API docs under network and events under networkRequest here, to see how to do things like upload text files in a single call, view bytes transferred and moreā€¦

Also, please note that there are a few new functional changes that aren’t backwards compatible. As you can see in the code example below, event responses are now tables which include fileName and baseDirectory. Be careful to ensure that you treat event.response as a table now instead of a string

Here is a simple example of how to use the new event.response table information.

local function networkListener( event )
        if ( event.isError ) then
                print( "Network error - download failed" )
        elseif ( event.phase == "ended" )
                print( "displaying response image file" )
                myImage = display.newImage( event.response.filename, event.response.baseDirectory, 60, 40 )
                myImage.alpha = 0
       myImage, { alpha = 1.0 } )

Posted by . Thanks for reading...

8 Responses to “Networking 2.0”

    • sq2

      Is event.bytesTransferred actually progress though? Does it work in the simulator? My quick tests suggest this isn’t the case.

  1. Perry

    One known bug at the moment (daily build 2013.1043) is that network error messages are not showing in Windows XP. We’re looking into it.

  2. Bryan

    Thanks for the comments! It’s worth noting that we have extended the message support under Windows XP and we have resolved several small behavioral differences on iOS and Android in the latest daily build.

  3. Paulo

    Is it compatible with older versions of Android?
    I have tested successfully with Kindle (Android 2.3.4), but it fails with Android 2.3.5 (return status -1).


Leave a Reply

  • (Will Not Be Published)