Sec-WebSocket-Key Error
While using your library I've never been able to get a successful response from the echo.websocket.org server. So, I added a Serial.print on the handshake section to debug the error and I got the following:
HTTP/1.1 400 Bad Request Server: Kaazing Gateway Date: Tue, 07 May 2013 05:11:21 GMT Access-Control-Allow-Origin: ArduinoWebSocketClient Access-Control-Allow-Credentials: true Access-Control-Allow-Headers: content-type Access-Control-Allow-Headers: authorization Access-Control-Allow-Headers: x-websocket-extensions Access-Control-Allow-Headers: x-websocket-version Access-Control-Allow-Headers: x-websocket-protocol Content-Type: text/html Content-Length: 63 Connection: Keep-Alive
Then, I tested it with a Node websocket server I created and got the following:
HTTP/1.1 400 Bad Request Connection: close X-WebSocket-Reject-Reason: Client must provide a value for Sec-WebSocket-Key.
Am I doing something wrong or does the library need to be updated?
Regards and Thanks a lot!!
As specified in the RFC6455( https://tools.ietf.org/html/rfc6455#section-1.2) you need to have a Sec-WebSocket-Key in the headers of your upgrade request. This library does not include such a header , i am currently working to fix that . If i succeed i will make a pull request.
This guy has a working solution https://github.com/hadleyrich/ArduinoWebsocketClient