Closed jonathanlundstrom closed 2 years ago
Hi @jonathanlundstrom
Thanks for using the library and your code is almost perfect, except
#if (defined(ARDUINO_RASPBERRY_PI_PICO_W))
#if defined(WEBSOCKETS_NETWORK_TYPE)
#undef WEBSOCKETS_NETWORK_TYPE
#endif
#define WEBSOCKETS_NETWORK_TYPE NETWORK_RP2040W_WIFI
#define _WEBSOCKETS_LOGLEVEL_ 10
#else
#error This code is intended to run only on the RP2040W boards ! Please check your Tools->Board setting.
#endif
must be placed before
#include <WebSocketsClient_Generic.h>
Moving those lines with
#define WEBSOCKETS_NETWORK_TYPE NETWORK_RP2040W_WIFI
to the top will solve your issue, unless your WS server is not working
There is nothing wrong with WiFiMulti at all
If you still have issue with PIO, try using Arduino IDE to isolate problem.
Good Luck,
Starting WebSockets_Generic_WiFiMulti on RASPBERRY_PI_PICO_W
Successfully connected to network HueNet1
Device IP address: 192.168.2.76
/ws/E6614103E7550737
192.168.2.30
[WSc] Connected to url: /
[WSc] get text: Connected
[WSc] get text: message here
[WSc] get ping
[WSc] Disconnected!
[WSc] Connected to url: /
[WSc] get text: Connected
[WSc] get text: message here
[WSc] get text: message here
[WSc] get text: message here
[WSc] get text: message here
[WSc] get text: message here
[WSc] get text: message here
[WSc] get text: message here
[WSc] get text: message here
[WSc] get text: message here
[WSc] get text: message here
[WSc] get text: message here
[WSc] get text: message here
[WSc] get text: message here
[WSc] get text: message here
[WSc] get text: message here
[WSc] get text: message here
[WSc] get text: message here
[WSc] get text: message here
[WSc] get text: message here
[WSc] get text: message here
[WSc] get text: message here
[WSc] get text: message here
[WSc] get text: message here
[WSc] get text: message here
[WSc] get text: message here
[WSc] get text: message here
[WSc] get text: message here
[WSc] get text: message here
[WSc] get text: message here
[WSc] get text: message here
[WSc] get text: message here
[WSc] get text: message here
[WSc] get text: message here
[WSc] get text: message here
[WSc] get text: message here
[WSc] get text: message here
[WSc] get text: message here
[WSc] get text: message here
...
Thank you!!
Hello,
We're developing an embedded application based on the Pico 2040W and are running the maxgerhardt platform with the earlephilhower Arduino Core with WiFiMulti for connectivity. The wireless connection works as intended but we're having troubles establishing a WebSocket connection to our FastAPI server. We've included your library but had to ignore many dependencies, because otherwise it would not build – is this a normal procedure?
Nonetheless, we try to connect using the following code:
The code runs, but I never reach a state where it prints anything, and when I check
webSocket.isConnected()
it returns false. My question is – could this have to do with our Wi-Fi library, or simply because it's unable to connect?The websocket endpoint is currently hosted on a local device at
192.168.1.212:8000/ws({device_id}
. I'm able to connect to this endpoint just fine using Postman or other Websocket programs, but not through this library.Any help is greatly appreciated! ❤️
Thanks, Jonathan