#include <WebSocket.h>
ErrorCode enum used to represent the error in the websocket.
| Enumerator |
|---|
| TIME_OUT |
|
| CONNECTION_FAILURE |
< value 0
|
| UNKNOWN |
< value 1
|
ErrorCode enum used to represent the error in the websocket.
| Enumerator |
|---|
| TIME_OUT |
|
| CONNECTION_FAILURE |
< value 0
|
| UNKNOWN |
< value 1
|
ErrorCode enum used to represent the error in the websocket.
| Enumerator |
|---|
| TIME_OUT |
|
| CONNECTION_FAILURE |
< value 0
|
| UNKNOWN |
< value 1
|
State enum used to represent the Websocket state.
| Enumerator |
|---|
| CONNECTING |
|
| OPEN |
< value 0
|
| CLOSING |
< value 1
|
| CLOSED |
< value 2
|
State enum used to represent the Websocket state.
| Enumerator |
|---|
| CONNECTING |
|
| OPEN |
< value 0
|
| CLOSING |
< value 1
|
| CLOSED |
< value 2
|
State enum used to represent the Websocket state.
| Enumerator |
|---|
| CONNECTING |
|
| OPEN |
< value 0
|
| CLOSING |
< value 1
|
| CLOSED |
< value 2
|
Closes the connection to server.
Closes the connection to server.
Closes the connection to server.
| bool init |
( |
const Delegate & |
delegate, |
|
|
const std::string & |
url, |
|
|
const std::vector< std::string > * |
protocols = nullptr |
|
) |
| |
The initialized method for websocket.
It needs to be invoked right after websocket instance is allocated.
- Parameters
-
| delegate | The delegate which want to receive event from websocket. |
| url | The URL of websocket server. |
- Returns
- true: Success, false: Failure.
| var init |
( |
var |
delegate, |
|
|
var |
url, |
|
|
var |
protocols = nullptr |
|
) |
| |
The initialized method for websocket.
It needs to be invoked right after websocket instance is allocated.
- Parameters
-
| delegate | The delegate which want to receive event from websocket. |
| url | The URL of websocket server. |
- Returns
- true: Success, false: Failure.
| void send |
( |
const std::string & |
message | ) |
|
Sends string data to websocket server.
- Parameters
-
Sends string data to websocket server.
- Parameters
-
| local sendstring |
( |
local |
message | ) |
|
Sends string data to websocket server.
- Parameters
-
| void send |
( |
const unsigned char * |
binaryMsg, |
|
|
unsigned int |
len |
|
) |
| |
Sends binary data to websocket server.
- Parameters
-
| binaryMsg | binary string data. |
| len | the size of binary string data. |
| var send |
( |
var |
binaryMsg, |
|
|
var |
len |
|
) |
| |
Sends binary data to websocket server.
- Parameters
-
| binaryMsg | binary string data. |
| len | the size of binary string data. |
| local sendstring |
( |
local |
binaryMsg, |
|
|
local |
len |
|
) |
| |
Sends binary data to websocket server.
- Parameters
-
| binaryMsg | binary string data. |
| len | the size of binary string data. |
friend class
WebSocketCallbackWrapper |
|
friend |
| friend class WsThreadHelper |
|
friend |
The documentation for this class was generated from the following file:
- /Users/minggo/SourceCode/cocos2d-x/cocos/network/WebSocket.h