8000 add deprecated warning for loop in async mode · lasseod/arduinoWebSockets@790a922 · GitHub
[go: up one dir, main page]

Skip to content

Commit 790a922

Browse files
committed
add deprecated warning for loop in async mode
fix sync mode
1 parent 5c2c257 commit 790a922

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

src/WebSocketsClient.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ void WebSocketsClient::handleClientData(void) {
340340
switch(_client.status) {
341341
case WSC_HEADER:
342342
{
343-
String headerLine = _client->tcp->readStringUntil('\n');
343+
String headerLine = _client.tcp->readStringUntil('\n');
344344
handleHeader(&_client, &headerLine);
345345
}
346346
break;

src/WebSocketsServer.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,15 +98,15 @@ void WebSocketsServer::begin(void) {
9898
DEBUG_WEBSOCKETS("[WS-Server] Server Started.\n");
9999
}
100100

101+
#if (WEBSOCKETS_NETWORK_TYPE != NETWORK_ESP8266_ASYNC)
101102
/**
102103
* called in arduino loop
103104
*/
104105
void WebSocketsServer::loop(void) {
105-
#if (WEBSOCKETS_NETWORK_TYPE != NETWORK_ESP8266_ASYNC)
106106
handleNewClients();
107107
handleClientData();
108-
#endif
109108
}
109+
#endif
110110

111111
/**
112112
* set callback function

src/WebSocketsServer.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,14 @@ class WebSocketsServer: private WebSockets {
4242
~WebSocketsServer(void);
4343

4444
void begin(void);
45+
#if (WEBSOCKETS_NETWORK_TYPE != NETWORK_ESP8266_ASYNC)
4546
void loop(void);
47+
#else
48+
// Async interface not need a loop call
49+
void loop(void) __attribute__ ((deprecated)) {
50+
51+
}
52+
#endif
4653

4754
void onEvent(WebSocketServerEvent cbEvent);
4855

0 commit comments

Comments
 (0)
0