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

#include <WebSocket.h>

Classes

struct  Data
 Data structure for message. More...
 
class  Delegate
 The delegate class to process websocket events. More...
 

Public Types

enum  ErrorCode { kErrorTimeout = 0, kErrorConnectionFailure, kErrorUnknown }
 Errors in websocket. More...
 
enum  State { kStateConnecting = 0, kStateOpen, kStateClosing, kStateClosed }
 Websocket state. More...
 

Public Member Functions

 WebSocket ()
 ctor ()
 WebSocket ()
virtual ~WebSocket ()
bool init (const Delegate &delegate, const std::string &url, const std::vector< std::string > *protocols=NULL)
 @ More...
 
void send (const std::string &message)
 Sends string data to websocket server. More...
 
void send (const unsigned char *binaryMsg, unsigned int len)
 Sends binary data to websocket server. More...
 
var send ( var binaryMsg, var len)
 Sends binary data to websocket server. More...
 
local send ( local binaryMsg, local len)
 Sends binary data to websocket server. More...
 
void close ()
 Closes the connection to server. More...
 
var close ()
 Closes the connection to server. More...
 
local close ()
 Closes the connection to server. More...
 
State getReadyState ()
 Gets current state of connection. More...
 
var getReadyState ()
 Gets current state of connection. More...
 
local getReadyState ()
 Gets current state of connection. More...
 

Friends

class WebSocketCallbackWrapper
class WsThreadHelper

Member Enumeration Documentation

enum ErrorCode

Errors in websocket.

Enumerator
kErrorTimeout 
kErrorConnectionFailure 
kErrorUnknown 
var ErrorCode

Errors in websocket.

Enumerator
kErrorTimeout 
kErrorConnectionFailure 
kErrorUnknown 
local ErrorCode

Errors in websocket.

Enumerator
kErrorTimeout 
kErrorConnectionFailure 
kErrorUnknown 
enum State

Websocket state.

Enumerator
kStateConnecting 
kStateOpen 
kStateClosing 
kStateClosed 
var State

Websocket state.

Enumerator
kStateConnecting 
kStateOpen 
kStateClosing 
kStateClosed 
local State

Websocket state.

Enumerator
kStateConnecting 
kStateOpen 
kStateClosing 
kStateClosed 

Constructor & Destructor Documentation

WebSocket ( )
var ctor ( )
local WebSocket ( )
virtual ~WebSocket ( )
virtual

Member Function Documentation

void close ( )

Closes the connection to server.

var close ( )

Closes the connection to server.

local close ( )

Closes the connection to server.

State getReadyState ( )

Gets current state of connection.

var getReadyState ( )

Gets current state of connection.

local getReadyState ( )

Gets current state of connection.

bool init ( const Delegate delegate,
const std::string &  url,
const std::vector< std::string > *  protocols = NULL 
)

@

@ @ @

void send ( const std::string &  message)

Sends string data to websocket server.

var send ( var  message)

Sends string data to websocket server.

local send ( local  message)

Sends string data to websocket server.

void send ( const unsigned char *  binaryMsg,
unsigned int  len 
)

Sends binary data to websocket server.

var send ( var  binaryMsg,
var  len 
)

Sends binary data to websocket server.

local send ( local  binaryMsg,
local  len 
)

Sends binary data to websocket server.

Friends And Related Function Documentation

friend class
WebSocketCallbackWrapper
friend
var WebSocketCallbackWrapper
friend
local WebSocketCallbackWrapper
friend
friend class WsThreadHelper
friend
var WsThreadHelper
friend
local WsThreadHelper
friend

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