These are chat archives for Links2004/arduinoWebSockets

8th
Feb 2016
Jack Cruden
@jackcruden
Feb 08 2016 01:48
Oh thanks! Should this work with the WebSocketClient example?
Jack Cruden
@jackcruden
Feb 08 2016 04:21
I've got the webSocketServer running (I've removed the 'arduino' protocol) and can connect with an HTML/JS client. I've got the WebSocketClient on the ESP8266-01 and it successfully connects to echo.websocket.org. I'm having an issue with talking to my server though. The server accepts the connection ("Connection accepted") but then loses the connection with "1006: Connection dropped by remote peer". Any hints on why this might be happening?
Also, the ESP repeatedly says "Disconnected".
Markus
@Links2004
Feb 08 2016 15:53
yes the nodejs Server will run with the examples.
try to enable debug:
https://github.com/Links2004/arduinoWebSockets/blob/master/src/WebSockets.h#L30
Jack Cruden
@jackcruden
Feb 08 2016 22:45
This message was deleted

Thanks for that! This is the output from echo.websocket.org.

[WS-Client] connect ws...
[WS-Client] connected to echo.websocket.org:80.
[WS-Client][sendHeader] sending header...
[WS-Client][sendHeader] sending header... Done (223331us).
[WS-Client][handleHeader] RX: HTTP/1.1 101 Web Socket Protocol Handshake
[WS-Client][handleHeader] RX: Connection: Upgrade
[WS-Client][handleHeader] RX: Date: Mon, 08 Feb 2016 21:31:22 GMT
[WS-Client][handleHeader] RX: Sec-WebSocket-Accept: Ozj4d8yb3jtL8m2hhFPilmaTqMM=
[WS-Client][handleHeader] RX: Server: Kaazing Gateway
[WS-Client][handleHeader] RX: Upgrade: websocket
[WS-Client][handleHeader] Header read fin.
[WS-Client][handleHeader] Client settings:
[WS-Client][handleHeader] - cURL: /
[WS-Client][handleHeader] - cKey: CwaONl+229g71fm2KJEBaw==
[WS-Client][handleHeader] Server header:
[WS-Client][handleHeader] - cCode: 101
[WS-Client][handleHeader] - cIsUpgrade: 1
[WS-Client][handleHeader] - cIsWebsocket: 1
[WS-Client][handleHeader] - cAccept: Ozj4d8yb3jtL8m2hhFPilmaTqMM=
[WS-Client][handleHeader] - cProtocol:
[WS-Client][handleHeader] - cExtensions:
[WS-Client][handleHeader] - cVersion: 0
[WS-Client][handleHeader] Websocket connection init done.
[WSc] Connected to url: /
[WS][0][sendFrame] ------- send massage frame -------
[WS][0][sendFrame] fin: 1 opCode: 1 mask: 1 length: 17 headerToPayload: 0
[WS][0][sendFrame] text: connect something
[WS][0][sendFrame] pack to one TCP package...
[WS][0][sendFrame] sending Frame Done (225187us).
[WS][0][handleWebsocket] ------- read massage frame -------
[WS][0][handleWebsocket] fin: 1 rsv1: 0 rsv2: 0 rsv3 0 opCode: 1
[WS][0][handleWebsocket] mask: 0 payloadLen: 17
[WS][0][handleWebsocket] text: connect something
[WSc] get text: connect something

And this is the output from my server. Wondering if it's a server Nginx issue.

[WS-Client] connect ws...
[WS-Client] connected to socket.myserver.com:80.
[WS-Client][sendHeader] sending header...
[WS-Client][sendHeader] sending header... Done (157167us).
[WS-Client][handleHeader] RX: HTTP/1.1 101 Switching Protocols
[WS-Client][handleHeader] RX: Server: nginx/1.8.0
[WS-Client][handleHeader] RX: Date: Mon, 08 Feb 2016 21:28:21 GMT
[WS-Client][handleHeader] RX: Connection: upgrade
[WS-Client][handleHeader] RX: Upgrade: websocket
[WS-Client][handleHeader] RX: Sec-WebSocket-Accept: YHAMtHaqTsZXhL+MTVTUyI+eQNk=
[WS-Client][handleHeader] Header read fin.
[WS-Client][handleHeader] Client settings:
[WS-Client][handleHeader] - cURL: /
[WS-Client][handleHeader] - cKey: Uv16CVGsE/TYt/gorYjW8w==
[WS-Client][handleHeader] Server header:
[WS-Client][handleHeader] - cCode: 101
[WS-Client][handleHeader] - cIsUpgrade: 0
[WS-Client][handleHeader] - cIsWebsocket: 1
[WS-Client][handleHeader] - cAccept: YHAMtHaqTsZXhL+MTVTUyI+eQNk=
[WS-Client][handleHeader] - cProtocol:
[WS-Client][handleHeader] - cExtensions:
[WS-Client][handleHeader] - cVersion: 0
[WS-Client][handleHeader] no Websocket connection close.
[WS-Client] client disconnected.

Jack Cruden
@jackcruden
Feb 08 2016 23:44
I've narrowed it down to a Nginx config issue. Thanks for your help!