skaarj1989 / mWebSockets

WebSockets for microcontrollers
https://skaarj1989.github.io/mWebSockets/autobahn-testsuite/servers/
MIT License
108 stars 23 forks source link

Client not working on ESP32-S3 WIFI #70

Closed brucedk closed 8 months ago

brucedk commented 10 months ago

Describe the bug I'm using a ESP32-S3 DevkitC-1 in wifi mode, when I'm working as a server, it all works, but when I set it as client, it gives me this error

[  1265][E][esp32-hal-adc.c:158] __analogRead(): Pin 0 is not ADC pin!

Environment info

Failure log

Connecting to tecnica
.. connected
Device IP: 192.168.10.236
[  1265][E][esp32-hal-adc.c:158] __analogRead(): Pin 0 is not ADC pin!
Connection failed!
brucedk commented 10 months ago

I'm using the example codes to test

skaarj1989 commented 10 months ago

What kind of WebSocket server do you use? Please mind that the SSL connection is not supported.

brucedk commented 10 months ago

I'm using the same library with a arduino mega 2560 and a 28J60. with the arduino as a client and the esp32 as a server, it works. when I reverse, it give me the error above. the arduino as a server I can connect with a nodejs as a client. and I'm not using ssl

skaarj1989 commented 10 months ago

I'm talking about a scenerio when you have a WebSocket client (this library) uploaded into a ESP32 board. What is your server endpoint? also this library?

open config.h and uncomment debugging defines.

brucedk commented 10 months ago

I'm talking about a scenerio when you have a WebSocket client (this library) uploaded into a ESP32 board. What is your server endpoint? also this library?

Yes, in a Arduino Mega 2560

this is the console log with the uncomment debuging

Connecting to tecnica
.. connected
Device IP: 192.168.10.236
[  1264][E][esp32-hal-adc.c:158] __analogRead(): Pin 0 is not ADC pin!
[Line #0] HTTP/1.1 400 Bad Request
Error during WebSocket handshake: net::ERR_INVALID_HTTP_RESPONSE
Connection failed!
skaarj1989 commented 10 months ago

And what about a debug log of a server?

brucedk commented 10 months ago

it does not receive any data, even with the debug enable

skaarj1989 commented 10 months ago

The connection was rejected way before the handshake. Make sure that your ip and port is correct when using client.open(...)

brucedk commented 9 months ago

just check again, ip and port are correct. this error only happens when the ip and port are correct, if it is wrong it only shows the connection failed, without the analogread error

skaarj1989 commented 9 months ago
  1. Is your host argument (in client.open()) in a form: xxx.xxx.xxx.xxx or ws://...?
  2. Are you able to connect to WebSocket server from any other endpoint (a browser client, or node.js)?
brucedk commented 9 months ago

the host is xxx.xxx.xxx.xxx and the server connect to a nodejs client as a test

skaarj1989 commented 9 months ago

Actually it's the other way around, the client connets to a server (server can only accept/reject a client). Anyways, I can't help you with debugging without a servers log. Looks like WiFi controller rejects a connection (I don't know why).

On a board that you have a WebSocket client, could you upload any WebServer client sketch (try a built-in example)?

stale[bot] commented 8 months ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.