gitpod-io / gitpod

The developer platform for on-demand cloud development environments to create software faster and more securely.
https://www.gitpod.io
GNU Affero General Public License v3.0
12.89k stars 1.24k forks source link

Arduino Pro Websocket #15511

Closed hpssjellis closed 1 year ago

hpssjellis commented 1 year ago

Bug description

@axonasif

A gitpod of a nodeJS websocket see https://github.com/hpssjellis/gitpod-portenta-websocket works using an older Arduino called the Nano33 IOT but doesn't seem to work using the modern "Pro" Arduino Microcontrollers as websocket clients.

signal strength (RSSI):-49 dBm

Starting connection to server...
connected to server failed

disconnecting from server.

The websocket server on Gitpod works as tested by the contained browser page, but the new Arduino PortentaH7 does not connect. The code does work as tested on a different platform. I am not sure if the new Arduino has a security issue causing the problem or Gitpod has the security issue.

Presently I am not sure how Gitpod switches from port 8080 to port 443, which the WiFi SSL client is expecting, but it used to work with the older Arduinos.

If you have any suggestions I can test it out with my Arduino. The Arduino code is in the repository.

Here is the output when it runs (I used a different cloud server): (Kind of messy since it is debug info, but yes it can send a string of 125 characters in a payload 131 bytes long (extra at the start 2 bytes for format codes and 4 bytes for masking)


signal strength (RSSI):-51 dBm

Starting connection to server...
connected to server
HTTP/1.1 101 Switching Protocols
Date: Wed, 28 Dec 2022 05:15:10 GMT
Connection: upgrade
Upgrade: websocket
Sec-WebSocket-Accept: HSmrc0sMlYUkAGmm5OPpG2HaGWk=
CF-Ray: 7807d1082c3f8423-YVR
CF-Cache-Status: DYNAMIC
Server: cloudflare
alt-svc: h3=":443"; ma=86400, h3-29=":443"; ma=86400

⸮
Send: Hello
myMessage: ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890abcdefghijklmnopqrstuvwxyz~!@#$%^&*()_+67890123456789012345678901234567890123456789012345
mySize: 125
sizeof(myMessage)in bytes: 4
sizeof(myMessage)in integers: 4
myPayload: 81,FD,36,A,2B,2A,77,48,68,6E,73,4C,6C,62,7F,40,60,66,7B,44,64,7A,67,58,78,7E,63,5C,7C,72,6F,50,1A,18,5,3E,1E,1C,1,32,12,1A,57,68,48,4E,53,6C,4C,42,5F,60,40,46,5B,64,44,5A,47,78,58,5E,43,7C,5C,52,4F,70,55,B,76,29,F,F,68,2C,1,2,1F,55,0,1C,1,32,12,1A,7,38,18,1E,3,3C,1C,12,F,3A,1A,18,5,3E,1E,1C,1,32,12,1A,7,38,18,1E,3,3C,1C,12,F,3A,1A,18,5,3E,1E,1C,1,32,12,1A,7,38,18,1E,3,
myPayload: ⸮⸮6
+*wHhnsLlb@`f{DdzgXx~c\|roP>2WhHNSlLB_`@F[dDZGxX^C|\ROpUv)h,U
sizeof(myPayload): 131
C⸮}ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890abcdefghijklmnopqrstuvwxyz~!@#$%^&*()_+67890123456789012345678901234567890123456789012345⸮
Send: Hello
myMessage: ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890abcdefghijklmnopqrstuvwxyz~!@#$%^&*()_+67890123456789012345678901234567890123456789012345
mySize: 125
sizeof(myMessage)in bytes: 4
sizeof(myMessage)in integers: 4
myPayload: 81,FD,5F,1B,17,23,1E,59,54,67,1A,5D,50,6B,16,51,5C,6F,12,55,58,73,E,49,44,77,A,4D,40,7B,6,41,26,11,6C,2F,22,15,68,23,2E,13,3E,79,74,47,3A,7D,70,4B,36,71,7C,4F,32,75,78,53,2E,69,64,57,2A,6D,60,5B,26,61,69,2,1F,38,33,6,1,3D,3D,B,76,44,3C,15,68,23,2E,13,6E,29,24,17,6A,2D,20,1B,66,2B,26,11,6C,2F,22,15,68,23,2E,13,6E,29,24,17,6A,2D,20,1B,66,2B,26,11,6C,2F,22,15,68,23,2E,13,6E,29,24,17,6A,
myPayload: ⸮⸮_#YTg]PkQ\oUXsIDw
M@{A&l/"h#.>ytG:}pK6q|O2uxS.idW*m`[&ai83==vD<h#.n)$j- f+&l/"h#.n)$j- f+&l/"h#.n)$j
sizeof(myPayload): 131
C⸮}ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890abcdefghijklmnopqrstuvwxyz~!@#$%^&*()_+67890123456789012345678901234567890123456789012345⸮

Any suggestions to try would be appreciated.

Steps to reproduce

Without an Arduino PortentaH7 you wont be able to test the code, buyt everything is in the repository README.md file

  1. Load the gitpod which runs node index.js
  2. make the port 8080 public and view the webpage index.html
  3. connect to the websocket server on the webpage to check that everything runs
  4. run the Arduino code on the portenta using your WiFi credentials and the same URL for the gitpod
  5. The Arduino should receive data from the browser webpage and should every 10 seconds send a 125 character string to the web browser using the socket.

Workspace affected

No response

Expected behavior

See listing above and this image of the webpage
image

Example repository

https://github.com/hpssjellis/gitpod-portenta-websocket

Anything else?

No response

stale[bot] commented 1 year 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.