0

Six years ago, (used ws version 0.4.32 now we use 7.2.1 ), I had a great little websocket that ran on http://repl.it and connected a Particle Photon to a webpage with very fast interaction < 10 ms per command. I need to now update my code for Arduinos new github here. The problem is that I don't know what the Arduino should reply to the node websocket to complete the connection. Any suggestions?

This used to work. (Note: I would randomly generate the Sec-WebSocket-Key)

client.println("GET / HTTP/1.1");
client.println("Host: myURL");
client.println("Upgrade: websocket");
client.println("Connection: Upgrade");
client.println("Sec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ==");
client.println("Sec-WebSocket-Version: 13");
client.println(); 

I am now running my up-to-date index.js on Gitpod.io Everything works, but I am confused with what the Arduino should send to the websocket to start the connection. Does anyone have any ideas?

Rocksetta
  • 35
  • 5
  • So I am making some headway. To get it working on Gitpod.io I just needed to swtich my Arduino to SSL. The code is at my [Github](https://github.com/hpssjellis/arduino-simple-websocket) Version 2.0.0-beta.0 of WS about 3 years ago seems to be the breaking point at the moment. – Rocksetta Feb 12 '20 at 07:58
  • So now the websocket server is working with the Arduino using the new version of WS, just having minor chat style communication issues with the server and the javascript pages.. The github is here https://github.com/hpssjellis/arduino-simple-websocket – Rocksetta Feb 12 '20 at 23:03
  • Solved it thanks to https://github.com/lpinca one of the maintainers of npm WS https://www.npmjs.com/package/ws for correcting my confused code. The github at https://github.com/hpssjellis/arduino-simple-websocket works fine for me allowing fast communication between a node websocket server and an Arduino – Rocksetta Feb 13 '20 at 06:42

0 Answers0