Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Broken examples/doc #75

Open
dmtzs opened this issue Jun 25, 2024 · 5 comments
Open

Broken examples/doc #75

dmtzs opened this issue Jun 25, 2024 · 5 comments

Comments

@dmtzs
Copy link

dmtzs commented Jun 25, 2024

Describe the bug
Wrong examples out of date

you need to update the examples, the actual ones are useless

@skaarj1989
Copy link
Owner

Everything compiles and works as it used to. Could you explain what you mean?

@dmtzs
Copy link
Author

dmtzs commented Jul 7, 2024

I receive this errors when I copy your client code that is in the README:

D:\github projects\Arduino\websocket\websocket.ino:13:17: error: 'net' is not a namespace-name
 using namespace net;
                 ^~~
D:\github projects\Arduino\websocket\websocket.ino:13:20: error: expected namespace-name before ';' token
 using namespace net;
                    ^
D:\github projects\Arduino\websocket\websocket.ino:20:23: error: variable or field 'onEventsCallback' declared void
 void onEventsCallback(WebsocketsEvent event, String data) {
                       ^~~~~~~~~~~~~~~
D:\github projects\Arduino\websocket\websocket.ino:20:23: error: 'WebsocketsEvent' was not declared in this scope
D:\github projects\Arduino\websocket\websocket.ino:20:23: note: suggested alternative: 'WebSocketClient'
 void onEventsCallback(WebsocketsEvent event, String data) {
                       ^~~~~~~~~~~~~~~
                       WebSocketClient
D:\github projects\Arduino\websocket\websocket.ino:20:53: error: expected primary-expression before 'data'
 void onEventsCallback(WebsocketsEvent event, String data) {
                                                     ^~~~
D:\github projects\Arduino\websocket\websocket.ino:77:20: error: variable or field 'handleMessage' declared void
 void handleMessage(WebsocketsMessage message) {
                    ^~~~~~~~~~~~~~~~~
D:\github projects\Arduino\websocket\websocket.ino:77:20: error: 'WebsocketsMessage' was not declared in this scope
D:\github projects\Arduino\websocket\websocket.ino:15:24: error: variable or field 'onMessageCallback' declared void
 void onMessageCallback(WebsocketsMessage message) {
                        ^~~~~~~~~~~~~~~~~
D:\github projects\Arduino\websocket\websocket.ino:15:24: error: 'WebsocketsMessage' was not declared in this scope
D:\github projects\Arduino\websocket\websocket.ino:20:23: error: variable or field 'onEventsCallback' declared void
 void onEventsCallback(WebsocketsEvent event, String data) {
                       ^~~~~~~~~~~~~~~
D:\github projects\Arduino\websocket\websocket.ino:20:23: error: 'WebsocketsEvent' was not declared in this scope
D:\github projects\Arduino\websocket\websocket.ino:20:23: note: suggested alternative: 'WebSocketClient'
 void onEventsCallback(WebsocketsEvent event, String data) {
                       ^~~~~~~~~~~~~~~
                       WebSocketClient
D:\github projects\Arduino\websocket\websocket.ino:20:53: error: expected primary-expression before 'data'
 void onEventsCallback(WebsocketsEvent event, String data) {
                                                     ^~~~
D:\github projects\Arduino\websocket\websocket.ino: In function 'void setup()':
D:\github projects\Arduino\websocket\websocket.ino:57:3: error: 'client' was not declared in this scope
   client.onOpen([](WebSocket &ws) {
   ^~~~~~
D:\github projects\Arduino\websocket\websocket.ino:57:3: note: suggested alternative: 'llrint'
   client.onOpen([](WebSocket &ws) {
   ^~~~~~
   llrint
D:\github projects\Arduino\websocket\websocket.ino:57:20: error: 'WebSocket' has not been declared
   client.onOpen([](WebSocket &ws) {
                    ^~~~~~~~~
D:\github projects\Arduino\websocket\websocket.ino: In lambda function:
D:\github projects\Arduino\websocket\websocket.ino:59:8: error: request for member 'send' in 'ws', which is of non-class type 'int'
     ws.send(WebSocket::DataType::TEXT, message, strlen(message));
        ^~~~
D:\github projects\Arduino\websocket\websocket.ino:59:13: error: 'WebSocket' has not been declared
     ws.send(WebSocket::DataType::TEXT, message, strlen(message));
             ^~~~~~~~~
D:\github projects\Arduino\websocket\websocket.ino: In function 'void setup()':
D:\github projects\Arduino\websocket\websocket.ino:61:21: error: 'WebSocket' has not been declared
   client.onClose([](WebSocket &ws, const WebSocket::CloseCode code,
                     ^~~~~~~~~
D:\github projects\Arduino\websocket\websocket.ino:61:42: error: 'WebSocket' does not name a type
   client.onClose([](WebSocket &ws, const WebSocket::CloseCode code,
                                          ^~~~~~~~~
D:\github projects\Arduino\websocket\websocket.ino: In lambda function:
D:\github projects\Arduino\websocket\websocket.ino:64:5: error: expected '{' before ';' token
   });
     ^
D:\github projects\Arduino\websocket\websocket.ino: In function 'void setup()':
D:\github projects\Arduino\websocket\websocket.ino:64:5: error: expected ')' before ';' token
D:\github projects\Arduino\websocket\websocket.ino:65:23: error: 'WebSocket' has not been declared
   client.onMessage([](WebSocket &ws, const WebSocket::DataType dataType,
                       ^~~~~~~~~
D:\github projects\Arduino\websocket\websocket.ino:65:44: error: 'WebSocket' does not name a type
   client.onMessage([](WebSocket &ws, const WebSocket::DataType dataType,
                                            ^~~~~~~~~
D:\github projects\Arduino\websocket\websocket.ino: In lambda function:
D:\github projects\Arduino\websocket\websocket.ino:68:5: error: expected '{' before ';' token
   });
     ^
D:\github projects\Arduino\websocket\websocket.ino: In function 'void setup()':
D:\github projects\Arduino\websocket\websocket.ino:68:5: error: expected ')' before ';' token
D:\github projects\Arduino\websocket\websocket.ino: In function 'void loop()':
D:\github projects\Arduino\websocket\websocket.ino:74:3: error: 'client' was not declared in this scope
   client.listen();
   ^~~~~~
D:\github projects\Arduino\websocket\websocket.ino:74:3: note: suggested alternative: 'llrint'
   client.listen();
   ^~~~~~
   llrint
D:\github projects\Arduino\websocket\websocket.ino: At global scope:
D:\github projects\Arduino\websocket\websocket.ino:77:20: error: variable or field 'handleMessage' declared void
 void handleMessage(WebsocketsMessage message) {
                    ^~~~~~~~~~~~~~~~~
D:\github projects\Arduino\websocket\websocket.ino:77:20: error: 'WebsocketsMessage' was not declared in this scope

exit status 1

Compilation error: 'net' is not a namespace-name

@dmtzs
Copy link
Author

dmtzs commented Jul 7, 2024

Using Arduino uno R4 WIFI @skaarj1989

@skaarj1989
Copy link
Owner

Now it's pretty obvious. Either you did not install mWebSockets or have more than one library with a header WebSocketClient.h, and Arduino picks the wrong one.

@dmtzs
Copy link
Author

dmtzs commented Jul 7, 2024

Well I installed this library first when I installed the arduino IDE, also is a new PC and of course I installed the mwebsockets library.
About thebother could be so if there is something then I will uninstall one then (if there's any) will come back later to give an update

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants