Cocos2d-x  v3.10
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Groups
HttpClient Class Reference

Singleton that handles asynchronous http requests. More...

Public Member Functions

void enableCookies (const char *cookieFile)
 Enable cookie support. More...
 
var enableCookies ( var cookieFile)
 Enable cookie support. More...
 
const std::string & getCookieFilename ()
 Get the cookie filename. More...
 
var getCookieFilename ()
 Get the cookie filename. More...
 
void setSSLVerification (const std::string &caFile)
 Set root certificate path for SSL verification. More...
 
const std::string & getSSLVerification ()
 Get ths SSL CA filename. More...
 
void send (HttpRequest *request)
 Add a request to task queue. More...
 
var send ( var request)
 Add a request to task queue. More...
 
void sendImmediate (HttpRequest *request)
 Immediate send a request. More...
 
void setTimeoutForConnect (int value)
 Set the timeout value for connecting in seconds. More...
 
var setTimeoutForConnect ( var value)
 Set the timeout value for connecting in seconds. More...
 
int getTimeoutForConnect ()
 Get the timeout value for connecting in seconds. More...
 
var getTimeoutForConnect ()
 Get the timeout value for connecting in seconds. More...
 
void setTimeoutForRead (int value)
 Set the timeout value for reading in seconds. More...
 
var setTimeoutForRead ( var value)
 Set the timeout value for reading in seconds. More...
 
int getTimeoutForRead ()
 Get the timeout value for reading in seconds. More...
 
var getTimeoutForRead ()
 Get the timeout value for reading in seconds. More...
 
HttpCookie * getCookie () const
 Get the Cookie object. More...
 
var getCookie ()
 Get the Cookie object. More...
 
std::mutex & getCookieFileMutex ()
 Get the _cookieFileMutex that represents the std::mutex of the cookie files. More...
 
var getCookieFileMutex ()
 Get the _cookieFileMutex that represents the std::mutex of the cookie files. More...
 
std::mutex & getSSLCaFileMutex ()
 Get the _sslCaFileMutex that represents the std::mutex of the SSL files. More...
 

Static Public Member Functions

static HttpClientgetInstance ()
 Get instance of HttpClient. More...
 
static void destroyInstance ()
 Destroy the instance of HttpClient.
 

Static Public Attributes

static const int RESPONSE_BUFFER_SIZE = 256
 The buffer size of _responseMessage.
 
var RESPONSE_BUFFER_SIZE = 256
 The buffer size of _responseMessage.
 

Detailed Description

Singleton that handles asynchronous http requests.

Once the request completed, a callback will be issued in main thread when it provided during make request.

Member Function Documentation

static HttpClient* getInstance ( )
static

Get instance of HttpClient.

the instance of HttpClient.

var getInstance ( )
static

Get instance of HttpClient.

the instance of HttpClient.

void enableCookies ( const char *  cookieFile)

Enable cookie support.

the filepath of cookie file.

var enableCookies ( var  cookieFile)

Enable cookie support.

the filepath of cookie file.

const std::string&
getCookieFilename
( )

Get the cookie filename.

the cookie filename

var getCookieFilename ( )

Get the cookie filename.

the cookie filename

void setSSLVerification ( const std::string &  caFile)

Set root certificate path for SSL verification.

a full path of root certificate.if it is empty, SSL verification is disabled.

var setSSLVerification ( var  caFile)

Set root certificate path for SSL verification.

a full path of root certificate.if it is empty, SSL verification is disabled.

const std::string&
getSSLVerification
( )

Get ths SSL CA filename.

the SSL CA filename

var getSSLVerification ( )

Get ths SSL CA filename.

the SSL CA filename

void send ( HttpRequest request)

Add a request to task queue.

a HttpRequest object, which includes url, response callback etc.

var send ( var  request)

Add a request to task queue.

a HttpRequest object, which includes url, response callback etc.

void sendImmediate ( HttpRequest request)

Immediate send a request.

a HttpRequest object, which includes url, response callback etc.

var sendImmediate ( var  request)

Immediate send a request.

a HttpRequest object, which includes url, response callback etc.

void setTimeoutForConnect ( int  value)

Set the timeout value for connecting in seconds.

the timeout value for connecting in seconds.

var setTimeoutForConnect ( var  value)

Set the timeout value for connecting in seconds.

the timeout value for connecting in seconds.

int getTimeoutForConnect ( )

Get the timeout value for connecting in seconds.

the timeout value for connecting in seconds.

var getTimeoutForConnect ( )

Get the timeout value for connecting in seconds.

the timeout value for connecting in seconds.

void setTimeoutForRead ( int  value)

Set the timeout value for reading in seconds.

the timeout value for reading in seconds.

var setTimeoutForRead ( var  value)

Set the timeout value for reading in seconds.

the timeout value for reading in seconds.

int getTimeoutForRead ( )

Get the timeout value for reading in seconds.

the timeout value for reading in seconds.

var getTimeoutForRead ( )

Get the timeout value for reading in seconds.

the timeout value for reading in seconds.

HttpCookie* getCookie ( ) const
inline

Get the Cookie object.

the Cookie object

var getCookie ( )
inline

Get the Cookie object.

the Cookie object

std::mutex& getCookieFileMutex ( )
inline

Get the _cookieFileMutex that represents the std::mutex of the cookie files.

the std::mutex

var getCookieFileMutex ( )
inline

Get the _cookieFileMutex that represents the std::mutex of the cookie files.

the std::mutex

std::mutex& getSSLCaFileMutex ( )
inline

Get the _sslCaFileMutex that represents the std::mutex of the SSL files.

the std::mutex

var getSSLCaFileMutex ( )
inline

Get the _sslCaFileMutex that represents the std::mutex of the SSL files.

the std::mutex


The documentation for this class was generated from the following file: