mirror of
https://github.com/Links2004/arduinoWebSockets.git
synced 2025-06-30 17:31:03 +02:00
Compare commits
5 Commits
Author | SHA1 | Date | |
---|---|---|---|
7a4c416082 | |||
87b23a48e9 | |||
bd011d8fd8 | |||
af17970256 | |||
66f69c3b20 |
@ -42,8 +42,8 @@ void webSocketEvent(uint8_t num, WStype_t type, uint8_t * payload, size_t length
|
||||
IPAddress ip = webSocket.remoteIP(num);
|
||||
USE_SERIAL.printf("[%u] Connected from %d.%d.%d.%d url: %s\n", num, ip[0], ip[1], ip[2], ip[3], payload);
|
||||
|
||||
// send message to client
|
||||
webSocket.sendTXT(num, "Connected");
|
||||
// send message to client
|
||||
webSocket.sendTXT(num, "Connected");
|
||||
}
|
||||
break;
|
||||
case WStype_TEXT:
|
||||
@ -62,12 +62,12 @@ void webSocketEvent(uint8_t num, WStype_t type, uint8_t * payload, size_t length
|
||||
// send message to client
|
||||
// webSocket.sendBIN(num, payload, length);
|
||||
break;
|
||||
case WStype_ERROR:
|
||||
case WStype_FRAGMENT_TEXT_START:
|
||||
case WStype_FRAGMENT_BIN_START:
|
||||
case WStype_FRAGMENT:
|
||||
case WStype_FRAGMENT_FIN:
|
||||
break;
|
||||
case WStype_ERROR:
|
||||
case WStype_FRAGMENT_TEXT_START:
|
||||
case WStype_FRAGMENT_BIN_START:
|
||||
case WStype_FRAGMENT:
|
||||
case WStype_FRAGMENT_FIN:
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -21,5 +21,5 @@
|
||||
"type": "git",
|
||||
"url": "https://github.com/Links2004/arduinoWebSockets.git"
|
||||
},
|
||||
"version": "2.6.0"
|
||||
"version": "2.6.1"
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
name=WebSockets
|
||||
version=2.6.0
|
||||
version=2.6.1
|
||||
author=Markus Sattler
|
||||
maintainer=Markus Sattler
|
||||
sentence=WebSockets for Arduino (Server + Client)
|
||||
|
@ -56,10 +56,10 @@ class SocketIOclient : protected WebSocketsClient {
|
||||
#ifndef SSL_AXTLS
|
||||
void beginSSLWithCA(const char * host, uint16_t port, const char * url = "/socket.io/?EIO=3", const char * CA_cert = NULL, const char * protocol = "arduino", uint32_t pingInterval = 60 * 1000, uint32_t pongTimeout = 90 * 1000, uint8_t disconnectTimeoutCount = 5);
|
||||
void setSSLClientCertKey(const char * clientCert = NULL, const char * clientPrivateKey = NULL);
|
||||
#if defined(SSL_BARESSL)
|
||||
#if defined(SSL_BARESSL)
|
||||
void beginSSLWithCA(const char * host, uint16_t port, const char * url = "/socket.io/?EIO=3", BearSSL::X509List * CA_cert = NULL, const char * protocol = "arduino", uint32_t pingInterval = 60 * 1000, uint32_t pongTimeout = 90 * 1000, uint8_t disconnectTimeoutCount = 5);
|
||||
void setSSLClientCertKey(BearSSL::X509List * clientCert = NULL, BearSSL::PrivateKey * clientPrivateKey = NULL);
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
bool isConnected(void);
|
||||
|
@ -262,9 +262,9 @@
|
||||
|
||||
#elif(WEBSOCKETS_NETWORK_TYPE == NETWORK_WIFI_NINA)
|
||||
#if __has_include(<WiFiNINA.h>)
|
||||
#include <WiFiNINA.h>
|
||||
#include <WiFiNINA.h>
|
||||
#else
|
||||
#error "Please install WiFiNINA library!"
|
||||
#error "Please install WiFiNINA library!"
|
||||
#endif
|
||||
|
||||
#define WEBSOCKETS_NETWORK_CLASS WiFiClient
|
||||
@ -273,10 +273,10 @@
|
||||
|
||||
#elif(WEBSOCKETS_NETWORK_TYPE == NETWORK_SAMD_SEED)
|
||||
#if __has_include(<rpcWiFi.h>) && __has_include(<rpcWiFiClientSecure.h>)
|
||||
#include <rpcWiFi.h>
|
||||
#include <rpcWiFiClientSecure.h>
|
||||
#include <rpcWiFi.h>
|
||||
#include <rpcWiFiClientSecure.h>
|
||||
#else
|
||||
#error "Please install rpcWiFi library!"
|
||||
#error "Please install rpcWiFi library!"
|
||||
#endif
|
||||
|
||||
#define WEBSOCKETS_NETWORK_CLASS WiFiClient
|
||||
|
@ -177,7 +177,6 @@ void WebSocketsClient::setSSLClientCertKey(BearSSL::X509List * clientCert, BearS
|
||||
}
|
||||
#endif // SSL_BARESSL
|
||||
|
||||
|
||||
#endif // SSL_AXTLS
|
||||
#endif // HAS_SSL
|
||||
|
||||
@ -245,12 +244,12 @@ void WebSocketsClient::loop(void) {
|
||||
if(_client.isSSL) {
|
||||
DEBUG_WEBSOCKETS("[WS-Client] connect wss...\n");
|
||||
if(_client.ssl) {
|
||||
#if(WEBSOCKETS_NETWORK_TYPE == NETWORK_WIFI_NINA) || (WEBSOCKETS_NETWORK_TYPE == NETWORK_SAMD_SEED) || (WEBSOCKETS_NETWORK_TYPE ==NETWORK_UNOWIFIR4)
|
||||
// does not support delete (no destructor)
|
||||
#else
|
||||
delete _client.ssl;
|
||||
#endif
|
||||
|
||||
#if(WEBSOCKETS_NETWORK_TYPE == NETWORK_WIFI_NINA) || (WEBSOCKETS_NETWORK_TYPE == NETWORK_SAMD_SEED) || (WEBSOCKETS_NETWORK_TYPE == NETWORK_UNOWIFIR4)
|
||||
// does not support delete (no destructor)
|
||||
#else
|
||||
delete _client.ssl;
|
||||
#endif
|
||||
|
||||
_client.ssl = NULL;
|
||||
_client.tcp = NULL;
|
||||
}
|
||||
@ -295,11 +294,11 @@ void WebSocketsClient::loop(void) {
|
||||
} else {
|
||||
DEBUG_WEBSOCKETS("[WS-Client] connect ws...\n");
|
||||
if(_client.tcp) {
|
||||
#if(WEBSOCKETS_NETWORK_TYPE == NETWORK_WIFI_NINA) || (WEBSOCKETS_NETWORK_TYPE == NETWORK_SAMD_SEED) || (WEBSOCKETS_NETWORK_TYPE ==NETWORK_UNOWIFIR4)
|
||||
// does not support delete (no destructor)
|
||||
#else
|
||||
#if(WEBSOCKETS_NETWORK_TYPE == NETWORK_WIFI_NINA) || (WEBSOCKETS_NETWORK_TYPE == NETWORK_SAMD_SEED) || (WEBSOCKETS_NETWORK_TYPE == NETWORK_UNOWIFIR4)
|
||||
// does not support delete (no destructor)
|
||||
#else
|
||||
delete _client.tcp;
|
||||
#endif
|
||||
#endif
|
||||
_client.tcp = NULL;
|
||||
}
|
||||
_client.tcp = new WEBSOCKETS_NETWORK_CLASS();
|
||||
@ -550,11 +549,11 @@ void WebSocketsClient::clientDisconnect(WSclient_t * client) {
|
||||
#if(WEBSOCKETS_NETWORK_TYPE == NETWORK_ESP8266_ASYNC)
|
||||
client->status = WSC_NOT_CONNECTED;
|
||||
#else
|
||||
#if(WEBSOCKETS_NETWORK_TYPE == NETWORK_WIFI_NINA) || (WEBSOCKETS_NETWORK_TYPE == NETWORK_SAMD_SEED) || (WEBSOCKETS_NETWORK_TYPE ==NETWORK_UNOWIFIR4)
|
||||
// does not support delete (no destructor)
|
||||
#else
|
||||
delete client->tcp;
|
||||
#endif
|
||||
#if(WEBSOCKETS_NETWORK_TYPE == NETWORK_WIFI_NINA) || (WEBSOCKETS_NETWORK_TYPE == NETWORK_SAMD_SEED) || (WEBSOCKETS_NETWORK_TYPE == NETWORK_UNOWIFIR4)
|
||||
// does not support delete (no destructor)
|
||||
#else
|
||||
delete client->tcp;
|
||||
#endif
|
||||
#endif
|
||||
client->tcp = NULL;
|
||||
}
|
||||
|
@ -48,10 +48,10 @@ class WebSocketsClient : protected WebSockets {
|
||||
void beginSSL(String host, uint16_t port, String url = "/", String fingerprint = "", String protocol = "arduino");
|
||||
#else
|
||||
void beginSSL(const char * host, uint16_t port, const char * url = "/", const uint8_t * fingerprint = NULL, const char * protocol = "arduino");
|
||||
#if defined(SSL_BARESSL)
|
||||
#if defined(SSL_BARESSL)
|
||||
void beginSslWithCA(const char * host, uint16_t port, const char * url = "/", BearSSL::X509List * CA_cert = NULL, const char * protocol = "arduino");
|
||||
void setSSLClientCertKey(BearSSL::X509List * clientCert = NULL, BearSSL::PrivateKey * clientPrivateKey = NULL);
|
||||
#endif
|
||||
#endif
|
||||
void setSSLClientCertKey(const char * clientCert = NULL, const char * clientPrivateKey = NULL);
|
||||
#endif
|
||||
void beginSslWithCA(const char * host, uint16_t port, const char * url = "/", const char * CA_cert = NULL, const char * protocol = "arduino");
|
||||
@ -131,11 +131,11 @@ class WebSocketsClient : protected WebSockets {
|
||||
#define SSL_FINGERPRINT_NULL ""
|
||||
#else
|
||||
const uint8_t * _fingerprint;
|
||||
#if defined(SSL_BARESSL)
|
||||
#if defined(SSL_BARESSL)
|
||||
BearSSL::X509List * _CA_cert;
|
||||
BearSSL::X509List * _client_cert;
|
||||
BearSSL::PrivateKey * _client_key;
|
||||
#endif
|
||||
#endif
|
||||
#define SSL_FINGERPRINT_IS_SET (_fingerprint != NULL)
|
||||
#define SSL_FINGERPRINT_NULL NULL
|
||||
#endif
|
||||
|
@ -25,6 +25,14 @@
|
||||
#include "WebSockets.h"
|
||||
#include "WebSocketsServer.h"
|
||||
|
||||
#ifdef ESP32
|
||||
#if defined __has_include
|
||||
#if __has_include("soc/wdev_reg.h")
|
||||
#include "soc/wdev_reg.h"
|
||||
#endif // __has_include
|
||||
#endif // defined __has_include
|
||||
#endif
|
||||
|
||||
WebSocketsServerCore::WebSocketsServerCore(const String & origin, const String & protocol) {
|
||||
_origin = origin;
|
||||
_protocol = protocol;
|
||||
@ -65,11 +73,11 @@ WebSocketsServerCore::~WebSocketsServerCore() {
|
||||
}
|
||||
|
||||
WebSocketsServer::~WebSocketsServer() {
|
||||
#if(WEBSOCKETS_NETWORK_TYPE == NETWORK_WIFI_NINA) || (WEBSOCKETS_NETWORK_TYPE == NETWORK_SAMD_SEED)
|
||||
// does not support delete (no destructor)
|
||||
#else
|
||||
delete _server;
|
||||
#endif
|
||||
#if(WEBSOCKETS_NETWORK_TYPE == NETWORK_WIFI_NINA) || (WEBSOCKETS_NETWORK_TYPE == NETWORK_SAMD_SEED)
|
||||
// does not support delete (no destructor)
|
||||
#else
|
||||
delete _server;
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
@ -87,6 +95,8 @@ void WebSocketsServerCore::begin(void) {
|
||||
|
||||
#ifdef ESP8266
|
||||
randomSeed(RANDOM_REG32);
|
||||
#elif defined(ESP32) && defined(WDEV_RND_REG)
|
||||
randomSeed(REG_READ(WDEV_RND_REG));
|
||||
#elif defined(ESP32)
|
||||
#define DR_REG_RNG_BASE 0x3ff75144
|
||||
randomSeed(READ_PERI_REG(DR_REG_RNG_BASE));
|
||||
@ -660,12 +670,12 @@ void WebSocketsServer::handleNewClients(void) {
|
||||
while(_server->hasClient()) {
|
||||
#endif
|
||||
|
||||
// store new connection
|
||||
#if(WEBSOCKETS_NETWORK_TYPE == NETWORK_WIFI_NINA)
|
||||
WEBSOCKETS_NETWORK_CLASS * tcpClient = new WEBSOCKETS_NETWORK_CLASS(_server->available());
|
||||
#else
|
||||
WEBSOCKETS_NETWORK_CLASS * tcpClient = new WEBSOCKETS_NETWORK_CLASS(_server->accept());
|
||||
#endif
|
||||
// store new connection
|
||||
#if(WEBSOCKETS_NETWORK_TYPE == NETWORK_WIFI_NINA)
|
||||
WEBSOCKETS_NETWORK_CLASS * tcpClient = new WEBSOCKETS_NETWORK_CLASS(_server->available());
|
||||
#else
|
||||
WEBSOCKETS_NETWORK_CLASS * tcpClient = new WEBSOCKETS_NETWORK_CLASS(_server->accept());
|
||||
#endif
|
||||
|
||||
if(!tcpClient) {
|
||||
DEBUG_WEBSOCKETS("[WS-Client] creating Network class failed!");
|
||||
|
@ -1,6 +1,6 @@
|
||||
/**
|
||||
* @file WebSocketsVersion.h
|
||||
* @date 25.08.2024
|
||||
* @date 06.09.2024
|
||||
* @author Markus Sattler
|
||||
*
|
||||
* Copyright (c) 2015 Markus Sattler. All rights reserved.
|
||||
@ -25,12 +25,12 @@
|
||||
#ifndef WEBSOCKETSVERSION_H_
|
||||
#define WEBSOCKETSVERSION_H_
|
||||
|
||||
#define WEBSOCKETS_VERSION "2.6.0"
|
||||
#define WEBSOCKETS_VERSION "2.6.1"
|
||||
|
||||
#define WEBSOCKETS_VERSION_MAJOR 2
|
||||
#define WEBSOCKETS_VERSION_MINOR 6
|
||||
#define WEBSOCKETS_VERSION_PATCH 0
|
||||
#define WEBSOCKETS_VERSION_PATCH 1
|
||||
|
||||
#define WEBSOCKETS_VERSION_INT 2006000
|
||||
#define WEBSOCKETS_VERSION_INT 2006001
|
||||
|
||||
#endif /* WEBSOCKETSVERSION_H_ */
|
||||
|
Reference in New Issue
Block a user