2626#include " WebSocketsServer.h"
2727
2828WebSocketsServer::WebSocketsServer (uint16_t port, String origin, String protocol) {
29- _port = port;
30- _origin = origin;
31- _protocol = protocol;
32- _runnning = false ;
33- _pingInterval = 0 ;
34- _pongTimeout = 0 ;
29+ _port = port;
30+ _origin = origin;
31+ _protocol = protocol;
32+ _runnning = false ;
33+ _pingInterval = 0 ;
34+ _pongTimeout = 0 ;
3535 _disconnectTimeoutCount = 0 ;
3636
3737 _server = new WEBSOCKETS_NETWORK_SERVER_CLASS (port);
@@ -95,8 +95,8 @@ void WebSocketsServer::begin(void) {
9595 client->cHttpLine = " " ;
9696#endif
9797
98- client->pingInterval = _pingInterval;
99- client->pongTimeout = _pongTimeout;
98+ client->pingInterval = _pingInterval;
99+ client->pongTimeout = _pongTimeout;
100100 client->disconnectTimeoutCount = _disconnectTimeoutCount;
101101 }
102102
@@ -489,11 +489,11 @@ bool WebSocketsServer::newClient(WEBSOCKETS_NETWORK_CLASS * TCPclient) {
489489 client->tcp ->readStringUntil (' \n ' , &(client->cHttpLine ), std::bind (&WebSocketsServer::handleHeader, this , client, &(client->cHttpLine )));
490490#endif
491491
492- client->pingInterval = _pingInterval;
493- client->pongTimeout = _pongTimeout;
492+ client->pingInterval = _pingInterval;
493+ client->pongTimeout = _pongTimeout;
494494 client->disconnectTimeoutCount = _disconnectTimeoutCount;
495- client->lastPing = millis ();
496- client->pongReceived = false ;
495+ client->lastPing = millis ();
496+ client->pongReceived = false ;
497497
498498 return true ;
499499 break ;
@@ -657,7 +657,7 @@ void WebSocketsServer::handleNewClients(void) {
657657 }
658658
659659 WEBSOCKETS_YIELD ();
660- #if (WEBSOCKETS_NETWORK_TYPE == NETWORK_ESP8266) || (WEBSOCKETS_NETWORK_TYPE == NETWORK_ESP32)
660+ #if (WEBSOCKETS_NETWORK_TYPE == NETWORK_ESP8266) || (WEBSOCKETS_NETWORK_TYPE == NETWORK_ESP32)
661661 }
662662#endif
663663}
@@ -686,7 +686,7 @@ void WebSocketsServer::handleClientData(void) {
686686 break ;
687687 }
688688 }
689-
689+
690690 handleHBPing (client);
691691 handleHBTimeout (client);
692692 }
@@ -873,7 +873,7 @@ void WebSocketsServer::handleHBPing(WSclient_t * client) {
873873 return ;
874874 uint32_t pi = millis () - client->lastPing ;
875875 if (pi > client->pingInterval ) {
876- DEBUG_WEBSOCKETS (" [WS-Server][%d] sending HB ping\n " , client->num );
876+ DEBUG_WEBSOCKETS (" [WS-Server][%d] sending HB ping\n " , client->num );
877877 if (sendPing (client->num )) {
878878 client->lastPing = millis ();
879879 client->pongReceived = false ;
@@ -888,10 +888,10 @@ void WebSocketsServer::handleHBPing(WSclient_t * client) {
888888 * @param disconnectTimeoutCount uint8_t how many timeouts before disconnect, 0=> do not disconnect
889889 */
890890void WebSocketsServer::enableHeartbeat (uint32_t pingInterval, uint32_t pongTimeout, uint8_t disconnectTimeoutCount) {
891- _pingInterval = pingInterval;
892- _pongTimeout = pongTimeout;
891+ _pingInterval = pingInterval;
892+ _pongTimeout = pongTimeout;
893893 _disconnectTimeoutCount = disconnectTimeoutCount;
894-
894+
895895 WSclient_t * client;
896896 for (uint8_t i = 0 ; i < WEBSOCKETS_SERVER_CLIENT_MAX; i++) {
897897 client = &_clients[i];
@@ -904,10 +904,10 @@ void WebSocketsServer::enableHeartbeat(uint32_t pingInterval, uint32_t pongTimeo
904904 */
905905void WebSocketsServer::disableHeartbeat () {
906906 _pingInterval = 0 ;
907-
907+
908908 WSclient_t * client;
909909 for (uint8_t i = 0 ; i < WEBSOCKETS_SERVER_CLIENT_MAX; i++) {
910- client = &_clients[i];
910+ client = &_clients[i];
911911 client->pingInterval = 0 ;
912912 }
913913}
0 commit comments