Sming Framework API
Sming - Open Source framework for high efficiency WiFi SoC ESP8266 native development with C++ language.
|
Client to make persistent connection to websocket server. More...
Classes | |
class | WebsocketClient |
Delegate callback type for connection of websocket client. More... | |
Typedefs | |
typedef Delegate< void(WebsocketClient &wsClient, const String message)> | WebSocketClientMessageDelegate |
typedef Delegate< void(WebsocketClient &wsClient, uint8_t *data, size_t size)> | WebSocketClientBinaryDelegate |
Delegate callback type for received text message. More... | |
typedef Delegate< void(WebsocketClient &wsClient, bool successful)> | WebSocketClientDisconnectDelegate |
Delegate callback type for received binary message. More... | |
typedef Delegate< void(WebsocketClient &wsClient, wsMode Mode)> | WebSocketClientConnectedDelegate |
Delegate callback type for disconnection of websocket client. More... | |
Enumerations | |
enum | wsMode : uint8_t { Disconnected = 0, Connecting, Connected } |
Websocket client modes enum. More... | |
Functions | |
WebsocketClient::WebsocketClient (bool autoDestruct=false) | |
void | WebsocketClient::setWebSocketMessageHandler (WebSocketClientMessageDelegate handler) |
void | WebsocketClient::setWebSocketDisconnectedHandler (WebSocketClientDisconnectDelegate handler) |
Set handler for websocket text messages. More... | |
void | WebsocketClient::setWebSocketConnectedHandler (WebSocketClientConnectedDelegate handler) |
Set handler for websocket disconnection event. More... | |
void | WebsocketClient::setWebSocketBinaryHandler (WebSocketClientBinaryDelegate handler) |
Set handler for websocket connection event. More... | |
bool | WebsocketClient::connect (String url, uint32_t sslOptions=0) |
Set handler for websocket binary messages. More... | |
void | WebsocketClient::sendPing () |
Connects websocket client to server. More... | |
void | WebsocketClient::sendPong () |
Send websocket ping to server. More... | |
void | WebsocketClient::disconnect () |
Send websocket ping to server. More... | |
void | WebsocketClient::sendMessage (char *msg, uint16_t length) |
Disconnects websocket client from server. More... | |
void | WebsocketClient::sendMessage (String str) |
Send text message to websocket server. More... | |
void | WebsocketClient::sendBinary (uint8_t *msg, uint16_t length) |
Send text message to websocket server. More... | |
wsMode | WebsocketClient::getWSMode () |
Send binary message to websocket server. More... | |
virtual void | WebsocketClient::onFinished (TcpClientState finishState) |
Get websocket client mode. More... | |
virtual void | WebsocketClient::onError (err_t err) |
virtual err_t | WebsocketClient::onReceive (pbuf *buf) |
bool | WebsocketClient::_verifyKey (char *buf, int size) |
void | WebsocketClient::_sendFrame (WSFrameType frameType, uint8_t *msg, uint16_t length) |
Client to make persistent connection to websocket server.
typedef Delegate<void(WebsocketClient& wsClient, uint8_t* data, size_t size)> WebSocketClientBinaryDelegate |
Delegate callback type for received text message.
typedef Delegate<void(WebsocketClient& wsClient, wsMode Mode)> WebSocketClientConnectedDelegate |
Delegate callback type for disconnection of websocket client.
typedef Delegate<void(WebsocketClient& wsClient, bool successful)> WebSocketClientDisconnectDelegate |
Delegate callback type for received binary message.
|
strong |
Websocket client modes enum.
bool WebsocketClient::connect | ( | String | url, |
uint32_t | sslOptions = 0 |
||
) |
Set handler for websocket binary messages.
handler | Delegate callback to be run when binary message received |
void WebsocketClient::disconnect | ( | ) |
Send websocket ping to server.
wsMode WebsocketClient::getWSMode | ( | ) |
Send binary message to websocket server.
msg | Pointer to binary-data buffer to be send to websocket server |
length | length of the binary-data buffer |
|
protectedvirtual |
void WebsocketClient::sendBinary | ( | uint8_t * | msg, |
uint16_t | length | ||
) |
Send text message to websocket server.
C++ | String to be send to websocket server |
void WebsocketClient::sendMessage | ( | char * | msg, |
uint16_t | length | ||
) |
Disconnects websocket client from server.
void WebsocketClient::sendMessage | ( | String | str | ) |
Send text message to websocket server.
msg | Pointer to NULL-terminated string buffer to be send to websocket server |
length | length of the NULL-terminated string buffer |
void WebsocketClient::sendPing | ( | ) |
Connects websocket client to server.
url | URL address of websocket server |
sslOptions | Specify the SSL options to be used when calling websocket server over SSL |
void WebsocketClient::sendPong | ( | ) |
Send websocket ping to server.
void WebsocketClient::setWebSocketBinaryHandler | ( | WebSocketClientBinaryDelegate | handler | ) |
Set handler for websocket connection event.
handler | Delegate callback to be run when websocket connects |
void WebsocketClient::setWebSocketConnectedHandler | ( | WebSocketClientConnectedDelegate | handler | ) |
Set handler for websocket disconnection event.
handler | Delegate callback to be run when websocket disconnects |
void WebsocketClient::setWebSocketDisconnectedHandler | ( | WebSocketClientDisconnectDelegate | handler | ) |
Set handler for websocket text messages.
handler | Delegate callback to be run when text message received |