cocos2d-x  3.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
HttpClient Class Reference

Singleton that handles asynchrounous http requests Once the request completed, a callback will issued in main thread when it provided during make request. More...

#include <HttpClient.h>

Public Member Functions

void enableCookies (const char *cookieFile)
 Enable cookie support. More...
 
var enableCookies ( var cookieFile)
 Enable cookie support. More...
 
local enableCookies ( local cookieFile)
 Enable cookie support. More...
 
void setSSLVerification (const std::string &caFile)
 Set root certificate path for SSL verification. More...
 
void send (HttpRequest *request)
 Add a get request to task queue. More...
 
void sendImmediate (HttpRequest *request)
 Immediate send a request. More...
 
void setTimeoutForConnect (int value)
 Change the connect timeout. More...
 
var setTimeoutForConnect ( var value)
 Change the connect timeout. More...
 
local setTimeoutForConnect ( local value)
 Change the connect timeout. More...
 
int getTimeoutForConnect ()
 Get connect timeout. More...
 
var getTimeoutForConnect ()
 Get connect timeout. More...
 
local getTimeoutForConnect ()
 Get connect timeout. More...
 
void setTimeoutForRead (int value)
 Change the download timeout. More...
 
var setTimeoutForRead ( var value)
 Change the download timeout. More...
 
local setTimeoutForRead ( local value)
 Change the download timeout. More...
 
int getTimeoutForRead ()
 Get download timeout. More...
 
var getTimeoutForRead ()
 Get download timeout. More...
 
local getTimeoutForRead ()
 Get download timeout. More...
 

Static Public Member Functions

static HttpClientgetInstance ()
 Return the shared instance. More...
 
static void destroyInstance ()
 Relase the shared instance. More...
 

Detailed Description

Singleton that handles asynchrounous http requests Once the request completed, a callback will issued in main thread when it provided during make request.

Member Function Documentation

static void destroyInstance ( )
static

Relase the shared instance.

var destroyInstance ( )
static

Relase the shared instance.

local destroyInstance ( )
static

Relase the shared instance.

void enableCookies ( const char *  cookieFile)

Enable cookie support.

var enableCookies ( var  cookieFile)

Enable cookie support.

local enableCookies ( local  cookieFile)

Enable cookie support.

static HttpClient* getInstance ( )
static

Return the shared instance.

var getInstance ( )
static

Return the shared instance.

local getInstance ( )
static

Return the shared instance.

int getTimeoutForConnect ( )
inline

Get connect timeout.

Returns
int
var getTimeoutForConnect ( )
inline

Get connect timeout.

Returns
int
local getTimeoutForConnect ( )
inline

Get connect timeout.

Returns
int
int getTimeoutForRead ( )
inline

Get download timeout.

Returns
int
var getTimeoutForRead ( )
inline

Get download timeout.

Returns
int
local getTimeoutForRead ( )
inline

Get download timeout.

Returns
int
void send ( HttpRequest request)

Add a get request to task queue.

Parameters
requesta HttpRequest object, which includes url, response callback etc. please make sure request->_requestData is clear before calling "send" here.
var send ( var  request)

Add a get request to task queue.

Parameters
requesta HttpRequest object, which includes url, response callback etc. please make sure request->_requestData is clear before calling "send" here.
local send ( local  request)

Add a get request to task queue.

Parameters
requesta HttpRequest object, which includes url, response callback etc. please make sure request->_requestData is clear before calling "send" here.
void sendImmediate ( HttpRequest request)

Immediate send a request.

Parameters
requesta HttpRequest object, which includes url, response callback etc. please make sure request->_requestData is clear before calling "sendImmediate" here.
var sendImmediate ( var  request)

Immediate send a request.

Parameters
requesta HttpRequest object, which includes url, response callback etc. please make sure request->_requestData is clear before calling "sendImmediate" here.
local sendImmediate ( local  request)

Immediate send a request.

Parameters
requesta HttpRequest object, which includes url, response callback etc. please make sure request->_requestData is clear before calling "sendImmediate" here.
void setSSLVerification ( const std::string &  caFile)

Set root certificate path for SSL verification.

Parameters
caFilea full path of root certificate. if it is empty, SSL verification is disabled.
var setSSLVerification ( var  caFile)

Set root certificate path for SSL verification.

Parameters
caFilea full path of root certificate. if it is empty, SSL verification is disabled.
local setSSLVerification ( local  caFile)

Set root certificate path for SSL verification.

Parameters
caFilea full path of root certificate. if it is empty, SSL verification is disabled.
void setTimeoutForConnect ( int  value)
inline

Change the connect timeout.

Parameters
valueThe desired timeout.
var setTimeoutForConnect ( var  value)
inline

Change the connect timeout.

Parameters
valueThe desired timeout.
local setTimeoutForConnect ( local  value)
inline

Change the connect timeout.

Parameters
valueThe desired timeout.
void setTimeoutForRead ( int  value)
inline

Change the download timeout.

Parameters
value
var setTimeoutForRead ( var  value)
inline

Change the download timeout.

Parameters
value
local setTimeoutForRead ( local  value)
inline

Change the download timeout.

Parameters
value

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