Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/greathqy/Cocos2d-x-Asynchronous-Http-Request-Library

A simple library wrote as a cocos2d-x extension that provides asynchronously http get/post/download request facility.
https://github.com/greathqy/Cocos2d-x-Asynchronous-Http-Request-Library

Last synced: 18 days ago
JSON representation

A simple library wrote as a cocos2d-x extension that provides asynchronously http get/post/download request facility.

Awesome Lists containing this project

README

        

A Cocos2d-x Asynchronous Http Request Libray That Let You Make Asynchrounous Http Requests From Cocos2d-x A FUN!
==================

You can find the library file:

* CCHttpRequest.h
* CCHttpRequest.cpp

Under CCHttpRequestExample/Classes

This library had been written as a cocos2d-x extension, Use it is very simple:

CCHttpRequest *gateway = CCHttpRequest::sharedHttpRequest();

//Get Request
std::string url = "http://www.baidu.com";
gateway->addGetTask(url, NULL, NULL);

//Post Request
std::string postData = "key=value";
gateway->addPostTask(url, postData, NULL, NULL);

//Download File
std::vector downloads;
downloads.push_back("http://www.baidu.com/index.php");
gateway->addDownloadTask(urls, NULL, NULL);

You can specify a callback just by simply replace the NULL parameter with your selector, So you can process the response data in your callback method.