#include <WebSocket.h>
◆ ErrorCode
Errors in websocket.
Enumerator |
---|
kErrorTimeout | |
kErrorConnectionFailure | |
kErrorUnknown | |
◆ State
Websocket state.
Enumerator |
---|
kStateConnecting | |
kStateOpen | |
kStateClosing | |
kStateClosed | |
◆ WebSocket()
◆ ~WebSocket()
◆ close()
Closes the connection to server.
◆ getReadyState()
Gets current state of connection.
◆ init()
bool init |
( |
const Delegate & |
delegate, |
|
|
const std::string & |
url, |
|
|
const std::vector< std::string > * |
protocols = NULL |
|
) |
| |
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 NA
◆ send() [1/2]
void send |
( |
const std::string & |
message | ) |
|
Sends string data to websocket server.
◆ send() [2/2]
void send |
( |
const unsigned char * |
binaryMsg, |
|
|
unsigned int |
len |
|
) |
| |
Sends binary data to websocket server.
◆ WebSocketCallbackWrapper
friend class WebSocketCallbackWrapper |
|
friend |
◆ WsThreadHelper
friend class WsThreadHelper |
|
friend |
The documentation for this class was generated from the following file:
- /home/runner/work/cocos-headers/cocos-headers/extensions/network/WebSocket.h