Closed guilhermeaiolfi closed 2 years ago
hasClient()
is from esp8266 WiFi library. They need it because of wrong implementation of the original Arduino WiFi API for available()
.
In Arduino WiFi API you can check available()
and you don't have to process the returned client. In esp8266 WiFi library available()
behaves as Arduino API recent addition accept()
in Ethernet library.
https://www.arduino.cc/en/Reference/WiFiServerAvailable
https://www.arduino.cc/en/Reference/EthernetServerAccept
https://github.com/esp8266/Arduino/blob/master/libraries/ESP8266WiFi/src/ArduinoWiFiServer.h
hi,
I went ahead and update the firmware of my ESP8266 to 2.2 using the links you put in the readme. The WebServer example worked as expected. So I tried using it together with mWebSocket. It didn't worked. After a few hours investigating I found the problem. The headers are not completed. For example, when trying to read the first line like so:
String line = client.readStringUntil('\n');
line.trim();
I get something like:
32,e-Control:32,secure-Req32,Mozilla/5.32,n64; x632,/html,application/32,lication/signed-exchan32,0.9
In the case of a websocket connection:
32,agma: no-cache
But the first line should be something like:
GET /path HTTP 1.1
I know it is not related to mWebSocket, because the problem is present in the webserver WiFiEspAT's example.
Do you have any idea what is going on?
Nevermind, for my own reference and others with similar problems, the solution is in the docs:
For AT firmware version 2.1.0 or higher open in the folder of the library the file src/utility/EspAtDrvTypes.h in a text editor and comment out the line #define WIFIESPAT1 like this //#define WIFIESPAT1
Sorry about that.
Hi,
sorry if the question is somehow dumb, I've just started playing around in the arduino world. What I'm trying to do is to use the https://github.com/skaarj1989/mWebSockets library using WiFiEsp. I would be willing to implement what is need in the mWebSocket side for it to work. But as I scanned the code, there are some missing API, like
hasClient()
.What would it be the equivalent of that method in WiFiEspAT? Is that even make any sense? Any guidance would welcome.
Thanks.