forked from Links2004/arduinoWebSockets
+ constructors for scalars
This commit is contained in:
@ -258,11 +258,7 @@ typedef struct {
|
|||||||
uint8_t * maskKey;
|
uint8_t * maskKey;
|
||||||
} WSMessageHeader_t;
|
} WSMessageHeader_t;
|
||||||
|
|
||||||
struct WSclient_t {
|
typedef struct {
|
||||||
|
|
||||||
WSclient_t (): status(WSC_NOT_CONNECTED)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void init (uint8_t num,
|
void init (uint8_t num,
|
||||||
uint32_t pingInterval,
|
uint32_t pingInterval,
|
||||||
@ -275,34 +271,34 @@ struct WSclient_t {
|
|||||||
this->disconnectTimeoutCount = disconnectTimeoutCount;
|
this->disconnectTimeoutCount = disconnectTimeoutCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t num; ///< connection number
|
uint8_t num = 0; ///< connection number
|
||||||
|
|
||||||
WSclientsStatus_t status;
|
WSclientsStatus_t status = WSC_NOT_CONNECTED;
|
||||||
|
|
||||||
WEBSOCKETS_NETWORK_CLASS * tcp;
|
WEBSOCKETS_NETWORK_CLASS * tcp = nullptr;
|
||||||
|
|
||||||
bool isSocketIO; ///< client for socket.io server
|
bool isSocketIO = false; ///< client for socket.io server
|
||||||
|
|
||||||
#if defined(HAS_SSL)
|
#if defined(HAS_SSL)
|
||||||
bool isSSL; ///< run in ssl mode
|
bool isSSL = false; ///< run in ssl mode
|
||||||
WEBSOCKETS_NETWORK_SSL_CLASS * ssl;
|
WEBSOCKETS_NETWORK_SSL_CLASS * ssl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
String cUrl; ///< http url
|
String cUrl; ///< http url
|
||||||
uint16_t cCode; ///< http code
|
uint16_t cCode = 0; ///< http code
|
||||||
|
|
||||||
bool cIsClient = false; ///< will be used for masking
|
bool cIsClient = false; ///< will be used for masking
|
||||||
bool cIsUpgrade; ///< Connection == Upgrade
|
bool cIsUpgrade = false; ///< Connection == Upgrade
|
||||||
bool cIsWebsocket; ///< Upgrade == websocket
|
bool cIsWebsocket = false; ///< Upgrade == websocket
|
||||||
|
|
||||||
String cSessionId; ///< client Set-Cookie (session id)
|
String cSessionId; ///< client Set-Cookie (session id)
|
||||||
String cKey; ///< client Sec-WebSocket-Key
|
String cKey; ///< client Sec-WebSocket-Key
|
||||||
String cAccept; ///< client Sec-WebSocket-Accept
|
String cAccept; ///< client Sec-WebSocket-Accept
|
||||||
String cProtocol; ///< client Sec-WebSocket-Protocol
|
String cProtocol; ///< client Sec-WebSocket-Protocol
|
||||||
String cExtensions; ///< client Sec-WebSocket-Extensions
|
String cExtensions; ///< client Sec-WebSocket-Extensions
|
||||||
uint16_t cVersion; ///< client Sec-WebSocket-Version
|
uint16_t cVersion = 0; ///< client Sec-WebSocket-Version
|
||||||
|
|
||||||
uint8_t cWsRXsize; ///< State of the RX
|
uint8_t cWsRXsize = 0; ///< State of the RX
|
||||||
uint8_t cWsHeader[WEBSOCKETS_MAX_HEADER_SIZE]; ///< RX WS Message buffer
|
uint8_t cWsHeader[WEBSOCKETS_MAX_HEADER_SIZE]; ///< RX WS Message buffer
|
||||||
WSMessageHeader_t cWsHeaderDecode;
|
WSMessageHeader_t cWsHeaderDecode;
|
||||||
|
|
||||||
@ -311,21 +307,21 @@ struct WSclient_t {
|
|||||||
|
|
||||||
String extraHeaders;
|
String extraHeaders;
|
||||||
|
|
||||||
bool cHttpHeadersValid; ///< non-websocket http header validity indicator
|
bool cHttpHeadersValid = false; ///< non-websocket http header validity indicator
|
||||||
size_t cMandatoryHeadersCount; ///< non-websocket mandatory http headers present count
|
size_t cMandatoryHeadersCount; ///< non-websocket mandatory http headers present count
|
||||||
|
|
||||||
bool pongReceived;
|
bool pongReceived = false;
|
||||||
uint32_t pingInterval; // how often ping will be sent, 0 means "heartbeat is not active"
|
uint32_t pingInterval = 0; // how often ping will be sent, 0 means "heartbeat is not active"
|
||||||
uint32_t lastPing; // millis when last pong has been received
|
uint32_t lastPing = 0; // millis when last pong has been received
|
||||||
uint32_t pongTimeout; // interval in millis after which pong is considered to timeout
|
uint32_t pongTimeout = 0; // interval in millis after which pong is considered to timeout
|
||||||
uint8_t disconnectTimeoutCount; // after how many subsequent pong timeouts discconnect will happen, 0 means "do not disconnect"
|
uint8_t disconnectTimeoutCount = 0; // after how many subsequent pong timeouts discconnect will happen, 0 means "do not disconnect"
|
||||||
uint8_t pongTimeoutCount; // current pong timeout count
|
uint8_t pongTimeoutCount = 0; // current pong timeout count
|
||||||
|
|
||||||
#if(WEBSOCKETS_NETWORK_TYPE == NETWORK_ESP8266_ASYNC)
|
#if(WEBSOCKETS_NETWORK_TYPE == NETWORK_ESP8266_ASYNC)
|
||||||
String cHttpLine; ///< HTTP header lines
|
String cHttpLine; ///< HTTP header lines
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
};
|
} WSclient_t;
|
||||||
|
|
||||||
class WebSockets {
|
class WebSockets {
|
||||||
protected:
|
protected:
|
||||||
|
Reference in New Issue
Block a user