13 #ifndef WEBSOCKETCLIENT_H 14 #define WEBSOCKETCLIENT_H 16 #include "../Wiring/WiringFrameworkIncludes.h" 17 #include "TcpClient.h" 18 #include "../Delegate.h" 20 #include "../../Services/WebHelpers/aw-sha1.h" 21 #include "../../Services/WebHelpers/base64.h" 22 #include "../../Wiring/WString.h" 23 #include "../Digital.h" 24 #include <Network/WebsocketFrame.h> 35 Disconnected = 0, Connecting, Connected
74 bool connect(
String url, uint32_t sslOptions = 0);
88 void sendMessage(
char* msg, uint16_t length);
93 void sendMessage(
String str);
97 void sendBinary(uint8_t* msg, uint16_t length);
108 using TcpClient::addSslOptions;
109 using TcpClient::setSslFingerprint;
110 using TcpClient::pinCertificate;
111 using TcpClient::setSslClientKeyCert;
112 using TcpClient::freeSslClientKeyCert;
113 using TcpClient::getSsl;
117 virtual void onFinished(TcpClientState finishState);
118 virtual void onError(err_t err);
119 virtual err_t onReceive(pbuf *buf);
120 bool _verifyKey(
char *buf,
int size);
121 void _sendFrame(
WSFrameType frameType, uint8_t* msg, uint16_t length);
125 wsMode _mode = wsMode::Disconnected;
Definition: TcpClient.h:35
WSFrameType
Websocket frame types enum.
Definition: WebsocketFrame.h:21
Delegate< void(WebsocketClient &wsClient, bool successful)> WebSocketClientDisconnectDelegate
Delegate callback type for received binary message.
Definition: WebsocketClient.h:44
Delegate< void(WebsocketClient &wsClient, wsMode Mode)> WebSocketClientConnectedDelegate
Delegate callback type for disconnection of websocket client.
Definition: WebsocketClient.h:47
wsMode
Websocket client modes enum.
Definition: WebsocketClient.h:33
Delegate< void(WebsocketClient &wsClient, uint8_t *data, size_t size)> WebSocketClientBinaryDelegate
Delegate callback type for received text message.
Definition: WebsocketClient.h:41
Delegate callback type for connection of websocket client.
Definition: WebsocketClient.h:53