Using the new Arduino IDE for ESP8266 and found bugs, report them here

Moderator: igrr

User avatar
By jlawton
#93786 So I'm trying to build the websocket sketch as described on LaserGRBL's webpage, https://lasergrbl.com/usage/wifi-with-esp8266/ but I've got some compile errors, does someone recognize a file that might still be missing or might in fact have changed?

webserver:90:34: error: 'WStype_t' has not been declared
90 | void webSocketEvent(uint8_t num, WStype_t type, uint8_t * payload, size_t lenght)
| ^~~~~~~~
C:\Users\New\Documents\Arduino\sketch_mar01a\webserver.ino: In function 'void setup()':
webserver:169:37: error: cannot convert '<unresolved overloaded function type>' to 'WebSocketsServerCore::WebSocketServerEvent' {aka 'std::function<void(unsigned char, WStype_t, unsigned char*, unsigned int)>'}
169 | webSocket.onEvent(webSocketEvent);
| ^
In file included from C:\Users\New\Documents\Arduino\sketch_mar01a\webserver.ino:5:
C:\Users\New\Documents\Arduino\libraries\WebSockets\src/WebSocketsServer.h:50:39: note: initializing argument 1 of 'void WebSocketsServerCore::onEvent(WebSocketsServerCore::WebSocketServerEvent)'
50 | void onEvent(WebSocketServerEvent cbEvent);
| ~~~~~~~~~~~~~~~~~~~~~^~~~~~~
exit status 1
'WStype_t' has not been declared
C:\Users\New\Documents\Arduino\sketch_mar01a\webserver.ino: In function 'void webSocketEvent(uint8_t, WStype_t, uint8_t*, size_t)':
webserver:124:17: error: 'SendFormat' was not declared in this scope
124 | SendFormat(num, "Connected to: %s\n", WiFi.SSID().c_str());
| ^~~~~~~~~~
webserver:136:5: error: 'SendFormat' was not declared in this scope
136 | SendFormat(num,"CPU Freq: %uMHz\n", ESP.getCpuFreqMHz());
| ^~~~~~~~~~
exit status 1
'SendFormat' was not declared in this scope
User avatar
By rpiloverbd
#94270 Hi again. This tutorial may help you too. It's regarding ESP32 WEB SOCKET SERVER. It shows a web socket server, How web socket protocol is different from HTTP protocol, What is handshaking in networking, Three-way handshaking, Web socket application, and Creating web socket server using ESP32 module etc.

https://www.theengineeringprojects.com/ ... erver.html
User avatar
By Inq720
#94273 I think you have 3, maybe 4 threads started on this same subject, you did not respond to the advice given. The advice may be wrong, but it is sincerely given trying to help. Asking the same question over in a new thread, expecting a different answer isn't going to get you to a better answer. I think @rpiloverbd gave you the same advice once before in another thread and you didn't respond if it helped or not.

Maybe you need to start by making sure you have your environment setup correctly. I'll write this as if you are just beginning. No insult is implied if you are far more knowledgeable.

(1) Make sure you have the right board selected. You mentioned (in one of the other threads) you're using a NodeMCU. Select this and make sure all the other settings are correct, especially the Port menu item.
nodemcu.png


(2) Make sure you can create and compile one of the examples that come with the above library
There is no canned example of a WebSocket, I looked. This one at least create a web server... which is usually needed to spawn a WebSocket for browsers. Select and compile it.
compile.png


If that works OR NOT, let us know in this thread.
You do not have the required permissions to view the files attached to this post.