@@ -258,11 +258,7 @@ typedef struct {
258
258
uint8_t * maskKey;
259
259
} WSMessageHeader_t;
260
260
261
- struct WSclient_t {
262
-
263
- WSclient_t (): status(WSC_NOT_CONNECTED)
264
- {
265
- }
261
+ typedef struct {
266
262
267
263
void init (uint8_t num,
268
264
uint32_t pingInterval,
@@ -275,34 +271,34 @@ struct WSclient_t {
275
271
this ->disconnectTimeoutCount = disconnectTimeoutCount;
276
272
}
277
273
278
- uint8_t num; // /< connection number
274
+ uint8_t num = 0 ; // /< connection number
279
275
280
- WSclientsStatus_t status;
276
+ WSclientsStatus_t status = WSC_NOT_CONNECTED ;
281
277
282
- WEBSOCKETS_NETWORK_CLASS * tcp;
278
+ WEBSOCKETS_NETWORK_CLASS * tcp = nullptr ;
283
279
284
- bool isSocketIO; // /< client for socket.io server
280
+ bool isSocketIO = false ; // /< client for socket.io server
285
281
286
282
#if defined(HAS_SSL)
287
- bool isSSL; // /< run in ssl mode
283
+ bool isSSL = false ; // /< run in ssl mode
288
284
WEBSOCKETS_NETWORK_SSL_CLASS * ssl;
289
285
#endif
290
286
291
- String cUrl; // /< http url
292
- uint16_t cCode; // /< http code
287
+ String cUrl; // /< http url
288
+ uint16_t cCode = 0 ; // /< http code
293
289
294
290
bool cIsClient = false ; // /< will be used for masking
295
- bool cIsUpgrade; // /< Connection == Upgrade
296
- bool cIsWebsocket; // /< Upgrade == websocket
291
+ bool cIsUpgrade = false ; // /< Connection == Upgrade
292
+ bool cIsWebsocket = false ; // /< Upgrade == websocket
297
293
298
294
String cSessionId; // /< client Set-Cookie (session id)
299
295
String cKey; // /< client Sec-WebSocket-Key
300
296
String cAccept; // /< client Sec-WebSocket-Accept
301
297
String cProtocol; // /< client Sec-WebSocket-Protocol
302
298
String cExtensions; // /< client Sec-WebSocket-Extensions
303
- uint16_t cVersion; // /< client Sec-WebSocket-Version
299
+ uint16_t cVersion = 0 ; // /< client Sec-WebSocket-Version
304
300
305
- uint8_t cWsRXsize; // /< State of the RX
301
+ uint8_t cWsRXsize = 0 ; // /< State of the RX
306
302
uint8_t cWsHeader[WEBSOCKETS_MAX_HEADER_SIZE]; // /< RX WS Message buffer
307
303
WSMessageHeader_t cWsHeaderDecode;
308
304
@@ -311,21 +307,21 @@ struct WSclient_t {
311
307
312
308
String extraHeaders;
313
309
314
- bool cHttpHeadersValid; // /< non-websocket http header validity indicator
310
+ bool cHttpHeadersValid = false ; // /< non-websocket http header validity indicator
315
311
size_t cMandatoryHeadersCount; // /< non-websocket mandatory http headers present count
316
312
317
- bool pongReceived;
318
- uint32_t pingInterval; // how often ping will be sent, 0 means "heartbeat is not active"
319
- uint32_t lastPing; // millis when last pong has been received
320
- uint32_t pongTimeout; // interval in millis after which pong is considered to timeout
321
- uint8_t disconnectTimeoutCount; // after how many subsequent pong timeouts discconnect will happen, 0 means "do not disconnect"
322
- uint8_t pongTimeoutCount; // current pong timeout count
313
+ bool pongReceived = false ;
314
+ uint32_t pingInterval = 0 ; // how often ping will be sent, 0 means "heartbeat is not active"
315
+ uint32_t lastPing = 0 ; // millis when last pong has been received
316
+ uint32_t pongTimeout = 0 ; // interval in millis after which pong is considered to timeout
317
+ uint8_t disconnectTimeoutCount = 0 ; // after how many subsequent pong timeouts discconnect will happen, 0 means "do not disconnect"
318
+ uint8_t pongTimeoutCount = 0 ; // current pong timeout count
323
319
324
320
#if (WEBSOCKETS_NETWORK_TYPE == NETWORK_ESP8266_ASYNC)
325
321
String cHttpLine; // /< HTTP header lines
326
322
#endif
327
323
328
- };
324
+ } WSclient_t ;
329
325
330
326
class WebSockets {
331
327
protected:
0 commit comments