#include <WebSocket.h>
Errors in websocket.
Enumerator |
---|
TIME_OUT |
|
CONNECTION_FAILURE |
|
UNKNOWN |
|
Websocket state.
Enumerator |
---|
CONNECTING |
|
OPEN |
|
CLOSING |
|
CLOSED |
|
Closes the connection to server.
Gets current state of connection.
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
void send |
( |
const std::string & |
message | ) |
|
Sends string data to websocket server.
void send |
( |
const unsigned char * |
binaryMsg, |
|
|
unsigned int |
len |
|
) |
| |
Sends binary data to websocket server.
friend class WebSocketCallbackWrapper |
|
friend |
friend class WsThreadHelper |
|
friend |
The documentation for this class was generated from the following file:
- /Users/huihoo/Software/huihoo-code/cocos2d-x/cocos2d-x-3.3/cocos/network/WebSocket.h