MCPcopy Create free account
hub / github.com/JoaoLopesF/RemoteDebug / handleClientData

Method handleClientData

src/utility/WebSocketsServer.cpp:666–695  ·  view source on GitHub ↗

* Handel incomming data from Client */

Source from the content-addressed store, hash-verified

664 * Handel incomming data from Client
665 */
666void WebSocketsServer::handleClientData(void) {
667
668 WSclient_t * client;
669 for(uint8_t i = 0; i < WEBSOCKETS_SERVER_CLIENT_MAX; i++) {
670 client = &_clients[i];
671 if(clientIsConnected(client)) {
672 int len = client->tcp->available();
673 if(len > 0) {
674 //DEBUG_WEBSOCKETS("[WS-Server][%d][handleClientData] len: %d\n", client->num, len);
675 switch(client->status) {
676 case WSC_HEADER:
677 {
678 String headerLine = client->tcp->readStringUntil('\n');
679 handleHeader(client, &headerLine);
680 }
681 break;
682 case WSC_CONNECTED:
683 WebSockets::handleWebsocket(client);
684 break;
685 default:
686 WebSockets::clientDisconnect(client, 1002);
687 break;
688 }
689 }
690 }
691#if (WEBSOCKETS_NETWORK_TYPE == NETWORK_ESP8266)
692 delay(0);
693#endif
694 }
695}
696#endif
697
698/*

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected