mirror of
https://github.com/Links2004/arduinoWebSockets.git
synced 2025-07-16 16:52:05 +02:00
Merge branch 'master' into gpn18
This commit is contained in:
@ -4,11 +4,13 @@ os:
|
|||||||
- linux
|
- linux
|
||||||
env:
|
env:
|
||||||
matrix:
|
matrix:
|
||||||
- CPU="esp8266" BOARD="esp8266com:esp8266:generic:CpuFrequency=80" IDE_VERSION=1.6.5
|
- CPU="esp8266" BOARD="esp8266com:esp8266:generic:xtal=80" IDE_VERSION=1.6.5
|
||||||
- CPU="esp8266" BOARD="esp8266com:esp8266:generic:CpuFrequency=80,FlashSize=1M0,FlashMode=qio,FlashFreq=80" IDE_VERSION=1.8.5
|
- CPU="esp8266" BOARD="esp8266com:esp8266:generic:xtal=80,eesz=1M,FlashMode=qio,FlashFreq=80" IDE_VERSION=1.8.5
|
||||||
- CPU="esp8266" BOARD="esp8266com:esp8266:generic:CpuFrequency=80,Debug=Serial1" IDE_VERSION=1.6.5
|
- CPU="esp8266" BOARD="esp8266com:esp8266:generic:xtal=80,eesz=1M,FlashMode=qio,FlashFreq=80" IDE_VERSION=1.8.7
|
||||||
|
- CPU="esp8266" BOARD="esp8266com:esp8266:generic:xtal=80,dbg=Serial1" IDE_VERSION=1.6.5
|
||||||
- CPU="esp32" BOARD="espressif:esp32:esp32:FlashFreq=80" IDE_VERSION=1.6.5
|
- CPU="esp32" BOARD="espressif:esp32:esp32:FlashFreq=80" IDE_VERSION=1.6.5
|
||||||
- CPU="esp32" BOARD="espressif:esp32:esp32:FlashFreq=80" IDE_VERSION=1.8.5
|
- CPU="esp32" BOARD="espressif:esp32:esp32:FlashFreq=80" IDE_VERSION=1.8.5
|
||||||
|
- CPU="esp32" BOARD="espressif:esp32:esp32:FlashFreq=80" IDE_VERSION=1.8.7
|
||||||
|
|
||||||
script:
|
script:
|
||||||
- /sbin/start-stop-daemon --start --quiet --pidfile /tmp/custom_xvfb_1.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :1 -ac -screen 0 1280x1024x16
|
- /sbin/start-stop-daemon --start --quiet --pidfile /tmp/custom_xvfb_1.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :1 -ac -screen 0 1280x1024x16
|
||||||
|
@ -17,8 +17,6 @@
|
|||||||
WiFiMulti WiFiMulti;
|
WiFiMulti WiFiMulti;
|
||||||
WebSocketsClient webSocket;
|
WebSocketsClient webSocket;
|
||||||
|
|
||||||
HardwareSerial Serial1(2);
|
|
||||||
|
|
||||||
#define USE_SERIAL Serial1
|
#define USE_SERIAL Serial1
|
||||||
|
|
||||||
void hexdump(const void *mem, uint32_t len, uint8_t cols = 16) {
|
void hexdump(const void *mem, uint32_t len, uint8_t cols = 16) {
|
||||||
@ -59,6 +57,12 @@ void webSocketEvent(WStype_t type, uint8_t * payload, size_t length) {
|
|||||||
// send data to server
|
// send data to server
|
||||||
// webSocket.sendBIN(payload, length);
|
// webSocket.sendBIN(payload, length);
|
||||||
break;
|
break;
|
||||||
|
case WStype_ERROR:
|
||||||
|
case WStype_FRAGMENT_TEXT_START:
|
||||||
|
case WStype_FRAGMENT_BIN_START:
|
||||||
|
case WStype_FRAGMENT:
|
||||||
|
case WStype_FRAGMENT_FIN:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -19,8 +19,6 @@
|
|||||||
WiFiMulti WiFiMulti;
|
WiFiMulti WiFiMulti;
|
||||||
WebSocketsClient webSocket;
|
WebSocketsClient webSocket;
|
||||||
|
|
||||||
HardwareSerial Serial1(2);
|
|
||||||
|
|
||||||
#define USE_SERIAL Serial1
|
#define USE_SERIAL Serial1
|
||||||
|
|
||||||
void hexdump(const void *mem, uint32_t len, uint8_t cols = 16) {
|
void hexdump(const void *mem, uint32_t len, uint8_t cols = 16) {
|
||||||
@ -64,6 +62,12 @@ void webSocketEvent(WStype_t type, uint8_t * payload, size_t length) {
|
|||||||
// send data to server
|
// send data to server
|
||||||
// webSocket.sendBIN(payload, length);
|
// webSocket.sendBIN(payload, length);
|
||||||
break;
|
break;
|
||||||
|
case WStype_ERROR:
|
||||||
|
case WStype_FRAGMENT_TEXT_START:
|
||||||
|
case WStype_FRAGMENT_BIN_START:
|
||||||
|
case WStype_FRAGMENT:
|
||||||
|
case WStype_FRAGMENT_FIN:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -16,8 +16,6 @@
|
|||||||
WiFiMulti WiFiMulti;
|
WiFiMulti WiFiMulti;
|
||||||
WebSocketsServer webSocket = WebSocketsServer(81);
|
WebSocketsServer webSocket = WebSocketsServer(81);
|
||||||
|
|
||||||
HardwareSerial Serial1(2);
|
|
||||||
|
|
||||||
#define USE_SERIAL Serial1
|
#define USE_SERIAL Serial1
|
||||||
|
|
||||||
void hexdump(const void *mem, uint32_t len, uint8_t cols = 16) {
|
void hexdump(const void *mem, uint32_t len, uint8_t cols = 16) {
|
||||||
@ -64,6 +62,12 @@ void webSocketEvent(uint8_t num, WStype_t type, uint8_t * payload, size_t length
|
|||||||
// send message to client
|
// send message to client
|
||||||
// webSocket.sendBIN(num, payload, length);
|
// webSocket.sendBIN(num, payload, length);
|
||||||
break;
|
break;
|
||||||
|
case WStype_ERROR:
|
||||||
|
case WStype_FRAGMENT_TEXT_START:
|
||||||
|
case WStype_FRAGMENT_BIN_START:
|
||||||
|
case WStype_FRAGMENT:
|
||||||
|
case WStype_FRAGMENT_FIN:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/Links2004/arduinoWebSockets.git"
|
"url": "https://github.com/Links2004/arduinoWebSockets.git"
|
||||||
},
|
},
|
||||||
"version": "2.1.0",
|
"version": "2.1.2",
|
||||||
"license": "LGPL-2.1",
|
"license": "LGPL-2.1",
|
||||||
"export": {
|
"export": {
|
||||||
"exclude": [
|
"exclude": [
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
name=WebSockets
|
name=WebSockets
|
||||||
version=2.1.0
|
version=2.1.2
|
||||||
author=Markus Sattler
|
author=Markus Sattler
|
||||||
maintainer=Markus Sattler
|
maintainer=Markus Sattler
|
||||||
sentence=WebSockets for Arduino (Server + Client)
|
sentence=WebSockets for Arduino (Server + Client)
|
||||||
|
@ -161,15 +161,14 @@ uint8_t WebSockets::createHeader(uint8_t * headerPtr, WSopcode_t opcode, size_t
|
|||||||
* @param client WSclient_t * ptr to the client struct
|
* @param client WSclient_t * ptr to the client struct
|
||||||
* @param opcode WSopcode_t
|
* @param opcode WSopcode_t
|
||||||
* @param length size_t length of the payload
|
* @param length size_t length of the payload
|
||||||
* @param mask bool add dummy mask to the frame (needed for web browser)
|
|
||||||
* @param fin bool can be used to send data in more then one frame (set fin on the last frame)
|
* @param fin bool can be used to send data in more then one frame (set fin on the last frame)
|
||||||
* @return true if ok
|
* @return true if ok
|
||||||
*/
|
*/
|
||||||
bool WebSockets::sendFrameHeader(WSclient_t * client, WSopcode_t opcode, size_t length, bool mask, bool fin) {
|
bool WebSockets::sendFrameHeader(WSclient_t * client, WSopcode_t opcode, size_t length, bool fin) {
|
||||||
uint8_t maskKey[4] = { 0x00, 0x00, 0x00, 0x00 };
|
uint8_t maskKey[4] = { 0x00, 0x00, 0x00, 0x00 };
|
||||||
uint8_t buffer[WEBSOCKETS_MAX_HEADER_SIZE] = { 0 };
|
uint8_t buffer[WEBSOCKETS_MAX_HEADER_SIZE] = { 0 };
|
||||||
|
|
||||||
uint8_t headerSize = createHeader(&buffer[0], opcode, length, mask, maskKey, fin);
|
uint8_t headerSize = createHeader(&buffer[0], opcode, length, client->cIsClient, maskKey, fin);
|
||||||
|
|
||||||
if(write(client, &buffer[0], headerSize) != headerSize) {
|
if(write(client, &buffer[0], headerSize) != headerSize) {
|
||||||
return false;
|
return false;
|
||||||
@ -186,12 +185,11 @@ bool WebSockets::sendFrameHeader(WSclient_t * client, WSopcode_t opcode, size_t
|
|||||||
* @param opcode WSopcode_t
|
* @param opcode WSopcode_t
|
||||||
* @param payload uint8_t * ptr to the payload
|
* @param payload uint8_t * ptr to the payload
|
||||||
* @param length size_t length of the payload
|
* @param length size_t length of the payload
|
||||||
* @param mask bool add dummy mask to the frame (needed for web browser)
|
|
||||||
* @param fin bool can be used to send data in more then one frame (set fin on the last frame)
|
* @param fin bool can be used to send data in more then one frame (set fin on the last frame)
|
||||||
* @param headerToPayload bool set true if the payload has reserved 14 Byte at the beginning to dynamically add the Header (payload neet to be in RAM!)
|
* @param headerToPayload bool set true if the payload has reserved 14 Byte at the beginning to dynamically add the Header (payload neet to be in RAM!)
|
||||||
* @return true if ok
|
* @return true if ok
|
||||||
*/
|
*/
|
||||||
bool WebSockets::sendFrame(WSclient_t * client, WSopcode_t opcode, uint8_t * payload, size_t length, bool mask, bool fin, bool headerToPayload) {
|
bool WebSockets::sendFrame(WSclient_t * client, WSopcode_t opcode, uint8_t * payload, size_t length, bool fin, bool headerToPayload) {
|
||||||
|
|
||||||
if(client->tcp && !client->tcp->connected()) {
|
if(client->tcp && !client->tcp->connected()) {
|
||||||
DEBUG_WEBSOCKETS("[WS][%d][sendFrame] not Connected!?\n", client->num);
|
DEBUG_WEBSOCKETS("[WS][%d][sendFrame] not Connected!?\n", client->num);
|
||||||
@ -204,7 +202,7 @@ bool WebSockets::sendFrame(WSclient_t * client, WSopcode_t opcode, uint8_t * pay
|
|||||||
}
|
}
|
||||||
|
|
||||||
DEBUG_WEBSOCKETS("[WS][%d][sendFrame] ------- send message frame -------\n", client->num);
|
DEBUG_WEBSOCKETS("[WS][%d][sendFrame] ------- send message frame -------\n", client->num);
|
||||||
DEBUG_WEBSOCKETS("[WS][%d][sendFrame] fin: %u opCode: %u mask: %u length: %u headerToPayload: %u\n", client->num, fin, opcode, mask, length, headerToPayload);
|
DEBUG_WEBSOCKETS("[WS][%d][sendFrame] fin: %u opCode: %u mask: %u length: %u headerToPayload: %u\n", client->num, fin, opcode, client->cIsClient, length, headerToPayload);
|
||||||
|
|
||||||
if(opcode == WSop_text) {
|
if(opcode == WSop_text) {
|
||||||
DEBUG_WEBSOCKETS("[WS][%d][sendFrame] text: %s\n", client->num, (payload + (headerToPayload ? 14 : 0)));
|
DEBUG_WEBSOCKETS("[WS][%d][sendFrame] text: %s\n", client->num, (payload + (headerToPayload ? 14 : 0)));
|
||||||
@ -228,7 +226,7 @@ bool WebSockets::sendFrame(WSclient_t * client, WSopcode_t opcode, uint8_t * pay
|
|||||||
headerSize = 10;
|
headerSize = 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(mask) {
|
if(client->cIsClient) {
|
||||||
headerSize += 4;
|
headerSize += 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -255,27 +253,27 @@ bool WebSockets::sendFrame(WSclient_t * client, WSopcode_t opcode, uint8_t * pay
|
|||||||
headerPtr = &buffer[0];
|
headerPtr = &buffer[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
createHeader(headerPtr, opcode, length, mask, maskKey, fin);
|
if(client->cIsClient && useInternBuffer) {
|
||||||
|
// if we use a Intern Buffer we can modify the data
|
||||||
|
// by this fact its possible the do the masking
|
||||||
|
for(uint8_t x = 0; x < sizeof(maskKey); x++) {
|
||||||
|
maskKey[x] = random(0xFF);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(mask) {
|
createHeader(headerPtr, opcode, length, client->cIsClient, maskKey, fin);
|
||||||
if(useInternBuffer) {
|
|
||||||
// if we use a Intern Buffer we can modify the data
|
|
||||||
// by this fact its possible the do the masking
|
|
||||||
for(uint8_t x = 0; x < sizeof(maskKey); x++) {
|
|
||||||
maskKey[x] = random(0xFF);
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t * dataMaskPtr;
|
if(client->cIsClient && useInternBuffer) {
|
||||||
|
uint8_t * dataMaskPtr;
|
||||||
|
|
||||||
if(headerToPayload) {
|
if(headerToPayload) {
|
||||||
dataMaskPtr = (payloadPtr + WEBSOCKETS_MAX_HEADER_SIZE);
|
dataMaskPtr = (payloadPtr + WEBSOCKETS_MAX_HEADER_SIZE);
|
||||||
} else {
|
} else {
|
||||||
dataMaskPtr = payloadPtr;
|
dataMaskPtr = payloadPtr;
|
||||||
}
|
}
|
||||||
|
|
||||||
for(size_t x = 0; x < length; x++) {
|
for(size_t x = 0; x < length; x++) {
|
||||||
dataMaskPtr[x] = (dataMaskPtr[x] ^ maskKey[x % 4]);
|
dataMaskPtr[x] = (dataMaskPtr[x] ^ maskKey[x % 4]);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -485,17 +483,18 @@ void WebSockets::handleWebsocketPayloadCb(WSclient_t * client, bool ok, uint8_t
|
|||||||
break;
|
break;
|
||||||
case WSop_ping:
|
case WSop_ping:
|
||||||
// send pong back
|
// send pong back
|
||||||
sendFrame(client, WSop_pong, payload, header->payloadLen, true);
|
sendFrame(client, WSop_pong, payload, header->payloadLen);
|
||||||
break;
|
break;
|
||||||
case WSop_pong:
|
case WSop_pong:
|
||||||
DEBUG_WEBSOCKETS("[WS][%d][handleWebsocket] get pong (%s)\n", client->num, payload ? (const char*)payload : "");
|
DEBUG_WEBSOCKETS("[WS][%d][handleWebsocket] get pong (%s)\n", client->num, payload ? (const char*)payload : "");
|
||||||
break;
|
break;
|
||||||
case WSop_close: {
|
case WSop_close: {
|
||||||
uint16_t reasonCode = 1000;
|
#ifndef NODEBUG_WEBSOCKETS
|
||||||
if(header->payloadLen >= 2) {
|
uint16_t reasonCode = 1000;
|
||||||
reasonCode = payload[0] << 8 | payload[1];
|
if(header->payloadLen >= 2) {
|
||||||
}
|
reasonCode = payload[0] << 8 | payload[1];
|
||||||
|
}
|
||||||
|
#endif
|
||||||
DEBUG_WEBSOCKETS("[WS][%d][handleWebsocket] get ask for close. Code: %d", client->num, reasonCode);
|
DEBUG_WEBSOCKETS("[WS][%d][handleWebsocket] get ask for close. Code: %d", client->num, reasonCode);
|
||||||
if(header->payloadLen > 2) {
|
if(header->payloadLen > 2) {
|
||||||
DEBUG_WEBSOCKETS(" (%s)\n", (payload + 2));
|
DEBUG_WEBSOCKETS(" (%s)\n", (payload + 2));
|
||||||
|
@ -192,10 +192,10 @@ typedef enum {
|
|||||||
WStype_CONNECTED,
|
WStype_CONNECTED,
|
||||||
WStype_TEXT,
|
WStype_TEXT,
|
||||||
WStype_BIN,
|
WStype_BIN,
|
||||||
WStype_FRAGMENT_TEXT_START,
|
WStype_FRAGMENT_TEXT_START,
|
||||||
WStype_FRAGMENT_BIN_START,
|
WStype_FRAGMENT_BIN_START,
|
||||||
WStype_FRAGMENT,
|
WStype_FRAGMENT,
|
||||||
WStype_FRAGMENT_FIN,
|
WStype_FRAGMENT_FIN,
|
||||||
} WStype_t;
|
} WStype_t;
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
@ -241,6 +241,7 @@ typedef struct {
|
|||||||
String cUrl; ///< http url
|
String cUrl; ///< http url
|
||||||
uint16_t cCode; ///< http code
|
uint16_t cCode; ///< http code
|
||||||
|
|
||||||
|
bool cIsClient = false; ///< will be used for masking
|
||||||
bool cIsUpgrade; ///< Connection == Upgrade
|
bool cIsUpgrade; ///< Connection == Upgrade
|
||||||
bool cIsWebsocket; ///< Upgrade == websocket
|
bool cIsWebsocket; ///< Upgrade == websocket
|
||||||
|
|
||||||
@ -287,8 +288,8 @@ class WebSockets {
|
|||||||
void clientDisconnect(WSclient_t * client, uint16_t code, char * reason = NULL, size_t reasonLen = 0);
|
void clientDisconnect(WSclient_t * client, uint16_t code, char * reason = NULL, size_t reasonLen = 0);
|
||||||
|
|
||||||
uint8_t createHeader(uint8_t * buf, WSopcode_t opcode, size_t length, bool mask, uint8_t maskKey[4], bool fin);
|
uint8_t createHeader(uint8_t * buf, WSopcode_t opcode, size_t length, bool mask, uint8_t maskKey[4], bool fin);
|
||||||
bool sendFrameHeader(WSclient_t * client, WSopcode_t opcode, size_t length = 0, bool mask = false, bool fin = true);
|
bool sendFrameHeader(WSclient_t * client, WSopcode_t opcode, size_t length = 0, bool fin = true);
|
||||||
bool sendFrame(WSclient_t * client, WSopcode_t opcode, uint8_t * payload = NULL, size_t length = 0, bool mask = false, bool fin = true, bool headerToPayload = false);
|
bool sendFrame(WSclient_t * client, WSopcode_t opcode, uint8_t * payload = NULL, size_t length = 0, bool fin = true, bool headerToPayload = false);
|
||||||
|
|
||||||
void headerDone(WSclient_t * client);
|
void headerDone(WSclient_t * client);
|
||||||
|
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
WebSocketsClient::WebSocketsClient() {
|
WebSocketsClient::WebSocketsClient() {
|
||||||
_cbEvent = NULL;
|
_cbEvent = NULL;
|
||||||
_client.num = 0;
|
_client.num = 0;
|
||||||
|
_client.cIsClient = true;
|
||||||
_client.extraHeaders = WEBSOCKETS_STRING("Origin: file://");
|
_client.extraHeaders = WEBSOCKETS_STRING("Origin: file://");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -194,7 +195,7 @@ bool WebSocketsClient::sendTXT(uint8_t * payload, size_t length, bool headerToPa
|
|||||||
length = strlen((const char *) payload);
|
length = strlen((const char *) payload);
|
||||||
}
|
}
|
||||||
if(clientIsConnected(&_client)) {
|
if(clientIsConnected(&_client)) {
|
||||||
return sendFrame(&_client, WSop_text, payload, length, true, true, headerToPayload);
|
return sendFrame(&_client, WSop_text, payload, length, true, headerToPayload);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -231,7 +232,7 @@ bool WebSocketsClient::sendTXT(char payload) {
|
|||||||
*/
|
*/
|
||||||
bool WebSocketsClient::sendBIN(uint8_t * payload, size_t length, bool headerToPayload) {
|
bool WebSocketsClient::sendBIN(uint8_t * payload, size_t length, bool headerToPayload) {
|
||||||
if(clientIsConnected(&_client)) {
|
if(clientIsConnected(&_client)) {
|
||||||
return sendFrame(&_client, WSop_binary, payload, length, true, true, headerToPayload);
|
return sendFrame(&_client, WSop_binary, payload, length, true, headerToPayload);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -248,7 +249,7 @@ bool WebSocketsClient::sendBIN(const uint8_t * payload, size_t length) {
|
|||||||
*/
|
*/
|
||||||
bool WebSocketsClient::sendPing(uint8_t * payload, size_t length) {
|
bool WebSocketsClient::sendPing(uint8_t * payload, size_t length) {
|
||||||
if(clientIsConnected(&_client)) {
|
if(clientIsConnected(&_client)) {
|
||||||
return sendFrame(&_client, WSop_ping, payload, length, true);
|
return sendFrame(&_client, WSop_ping, payload, length);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -115,7 +115,7 @@ void WebSocketsServer::close(void) {
|
|||||||
|
|
||||||
#if (WEBSOCKETS_NETWORK_TYPE == NETWORK_ESP8266)
|
#if (WEBSOCKETS_NETWORK_TYPE == NETWORK_ESP8266)
|
||||||
_server->close();
|
_server->close();
|
||||||
#elif (WEBSOCKETS_NETWORK_TYPE == NETWORK_ESP32)
|
#elif (WEBSOCKETS_NETWORK_TYPE == NETWORK_ESP32) || (WEBSOCKETS_NETWORK_TYPE == NETWORK_ESP8266_ASYNC)
|
||||||
_server->end();
|
_server->end();
|
||||||
#else
|
#else
|
||||||
// TODO how to close server?
|
// TODO how to close server?
|
||||||
@ -184,7 +184,7 @@ bool WebSocketsServer::sendTXT(uint8_t num, uint8_t * payload, size_t length, bo
|
|||||||
}
|
}
|
||||||
WSclient_t * client = &_clients[num];
|
WSclient_t * client = &_clients[num];
|
||||||
if(clientIsConnected(client)) {
|
if(clientIsConnected(client)) {
|
||||||
return sendFrame(client, WSop_text, payload, length, false, true, headerToPayload);
|
return sendFrame(client, WSop_text, payload, length, true, headerToPayload);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -222,7 +222,7 @@ bool WebSocketsServer::broadcastTXT(uint8_t * payload, size_t length, bool heade
|
|||||||
for(uint8_t i = 0; i < WEBSOCKETS_SERVER_CLIENT_MAX; i++) {
|
for(uint8_t i = 0; i < WEBSOCKETS_SERVER_CLIENT_MAX; i++) {
|
||||||
client = &_clients[i];
|
client = &_clients[i];
|
||||||
if(clientIsConnected(client)) {
|
if(clientIsConnected(client)) {
|
||||||
if(!sendFrame(client, WSop_text, payload, length, false, true, headerToPayload)) {
|
if(!sendFrame(client, WSop_text, payload, length, true, headerToPayload)) {
|
||||||
ret = false;
|
ret = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -263,7 +263,7 @@ bool WebSocketsServer::sendBIN(uint8_t num, uint8_t * payload, size_t length, bo
|
|||||||
}
|
}
|
||||||
WSclient_t * client = &_clients[num];
|
WSclient_t * client = &_clients[num];
|
||||||
if(clientIsConnected(client)) {
|
if(clientIsConnected(client)) {
|
||||||
return sendFrame(client, WSop_binary, payload, length, false, true, headerToPayload);
|
return sendFrame(client, WSop_binary, payload, length, true, headerToPayload);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -285,7 +285,7 @@ bool WebSocketsServer::broadcastBIN(uint8_t * payload, size_t length, bool heade
|
|||||||
for(uint8_t i = 0; i < WEBSOCKETS_SERVER_CLIENT_MAX; i++) {
|
for(uint8_t i = 0; i < WEBSOCKETS_SERVER_CLIENT_MAX; i++) {
|
||||||
client = &_clients[i];
|
client = &_clients[i];
|
||||||
if(clientIsConnected(client)) {
|
if(clientIsConnected(client)) {
|
||||||
if(!sendFrame(client, WSop_binary, payload, length, false, true, headerToPayload)) {
|
if(!sendFrame(client, WSop_binary, payload, length, true, headerToPayload)) {
|
||||||
ret = false;
|
ret = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user