-->
Page 1 of 1

Having trouble building websocket sketch

PostPosted: Tue Mar 01, 2022 6:38 pm
by jlawton
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

Re: Having trouble building websocket sketch

PostPosted: Mon Apr 11, 2022 3:07 am
by rpiloverbd
Hi, is this library installed properly in your computer?https://github.com/arkypita/ESP8266-SerialWebSocket

Re: Having trouble building websocket sketch

PostPosted: Wed Apr 13, 2022 8:26 am
by rpiloverbd
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

Re: Having trouble building websocket sketch

PostPosted: Wed Apr 13, 2022 11:46 am
by Inq720
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.