kanaka/noVNC — Issue #108: Problems using libwebsockets proxy
Author: abligh
Created: 2011-12-04 20:37:54+00:00
State: open

I have written code to proxy novnc using libwebsockets, and am having difficulty debugging a failure to connect. My code may have bugs (though I can't immediately see where), so I am really looking for a debugging pointer. This is with novnc git head as of about 2 minutes ago (commit 06a9ef0c6cd90746210f62d72b6bf8f0dcab9491).

What I see is the websocket negotiate fine, tcpdump shows what I believe is a sensible RFB packet with websocket encapsulation showing 2 byte header including 12 byte length + "RFB 003.008" + newline, but novnc does not appear to pick it up, and sends no reply.

novnc console output in firebug shows:

New state 'connect', was 'loaded'.
util.js (line 71)
>> RFB.connect
util.js (line 69)
connecting to ws://127.0.01:8080/
util.js (line 70)
<< RFB.connect
util.js (line 69)
>> WebSock.onopen
util.js (line 69)
Server chose sub-protocol: base64
util.js (line 70)
New state 'ProtocolVersion', was 'connect'. Msg: Starting VNC handshake
util.js (line 71)
Clearing connect timer
util.js (line 69)
<< WebSock.onopen

The content of the TCP packet sent from proxy to client is a binary frame under the v8 spec (i.e. a LWS_WS_OPCODE_07__BINARY_FRAME in libwebproxy terms), with the following bytes:
82:0c:52:46:42:20:30:30:33:2e:30:30:38:0a (the last 12 bytes being "RFB 003.008" + newline).

(note I have disabled deflate to make things easier to read; the same happens with deflate enabled).

But the JS client never appears to receive this and certainly does not send a reply. It appears to work with wsproxy.

Any ideas how to debug this further?