Closed hpssjellis closed 1 year ago
HI @hpssjellis
Sorry I don't have 2 Portenta_H7 to test, but you can help yourself by turning on the _WEBSOCKETS_LOGLEVEL_
level to 4 and figure out what's wrong
I'm testing OK here using PC WS server
Starting Portenta_H7-Client using WiFi on PORTENTA_H7_M7
WebSockets2_Generic v1.13.2
Connecting to SSID: HueNet
Connected to Wifi, IP address: 192.168.2.128
Connecting to WebSockets Server @192.168.2.30
[WS] WebsocketsClient::generateHandshake: base64Authorization =
[WS] WebsocketsClient::generateHandshake: handshake = GET / HTTP/1.1
Host: 192.168.2.30
Sec-WebSocket-Key: MDEyMzQ1Njc4OWFiY2RlZg==
Upgrade: websocket
Connection: Upgrade
Sec-WebSocket-Version: 13
User-Agent: TinyWebsockets Client
Authorization: Basic
Origin: https://github.com/khoih-prog/Websockets2_Generic
[WS] WebsocketsClient::connect: base64Authorization =
[WS] WebsocketsClient::generateHandshake: key = Upgrade
[WS] WebsocketsClient::generateHandshake: value = websocket
[WS] WebsocketsClient::generateHandshake: key = Connection
[WS] WebsocketsClient::generateHandshake: value = Upgrade
[WS] WebsocketsClient::generateHandshake: key = Sec-WebSocket-Accept
[WS] WebsocketsClient::generateHandshake: value = BACScCJPNqyz+UBoqMH89VmURoA=
[WS] WebsocketsClient::generateHandshake: key = Origin
[WS] WebsocketsClient::generateHandshake: value = https://github.com/khoih-prog/Websockets2_Generic
Connnection Opened
Connected!
Got Message: Hello to Server from PORTENTA_H7_M7
Got a Ping!
Got a Ping!
Got a Ping!
...
So the issue is normally in the bad Server code or Client-Server mismatch (IP, port, etc.)
Good Luck,
Thanks so much @khoih-prog so frustrating when things aren't working. Level 4 debug makes a lot of sense and using a seperate server is a good idea. I will keep testing. Great to know your code works on the Portenta. Thanks!
At least I understand the issue now. The ws server I am running is secure, your wifi client example is for an insecure websocket. I tried connectSecure but that doesn't seem to solve it. I will try making an insecure websocket server and see how I do.
@khoih-prog you are correct, I tested your server client with 2 Portenta and it works fine. I am a bit confused if they use an in-secure or secure SSL connection. I will mess around with it and see if I can get your server working with an SSL connection. I Any suggestions?
@hpssjellis
To use SSL / WSS, you have to adapt examples, written either for ESP32 or ESP8266 to Portenta
AFAIK, Portenta doesn't have built-in Root CA-Certs inside core firmware, you have to do more research on SSL and how to add those CA-Certs into Portenta.
Have a look at my other EthernetWebServer_SSL library for SSL / CA Certs, etc.
I'm sorry I haven't worked on Portenta recently and didn't add SSL-enabled examples to it. Hopefully you'll do it when everything is OK there.
Hi @khoih-prog any idea if anyone has lately tested the PortentaH7 with this library. I can't seem to get websocket type chat working.
I do use a web based websocket server, but that shouldn't be the issue. If I use 2 Portenta's is there an easily way to test if they are working?
I am using this example folder
https://github.com/khoih-prog/WebSockets2_Generic/tree/master/examples/Generic/Portenta_H7/WiFi
I really just want an SSL websocket client, but should I just be able to test one Portenta as a client and one as the server?
Actually that seems fairly simple. I will test that out.
......
Ok I tested the Portenta server and client. Looked fairly easy to understand. But no connection
Any idea why?