Unexpected Response Code
I am attempting to use WebSockets to access WebMFD. I get "Unexpected Response Code: 400". This occurs on the first button connection request. The html transfer of the MFD body works OK. I am using the WebMFD.dll version: 10/31/2010 from OrbitHangar. Please help.
Thanks.
Here is the Chrome net-internals log:
WEB_SOCKET_SEND_REQUEST_HEADERS
--> GET /btn/?key=1 HTTP/1.1
Upgrade: websocket
Connection: Upgrade
Host: 127.0.0.1:8042
Origin:
http://127.0.0.1:8042
Sec-WebSocket-Key: bSmimYpsePNYkZi38BqsNA==
Sec-WebSocket-Version: 13
Sec-WebSocket-Extensions: x-webkit-deflate-frame
SOCKET_STREAM_SENT
SOCKET_STREAM_RECEIVED
WEB_SOCKET_READ_RESPONSE_HEADERS
--> HTTP/1.0 400 BAD REQUEST
I looked at the source code and I see that 400 Bad Request can be for several reasons but I can't figure out how to get Chrome logging to show the next line of the response (after \r\n\r\n).
6/11/2012 - After lots of break points, I've found that new WebSocket only throws onclose with 1006 error code which is a user reserved code. It does not throw onerror. I still can't find the next line of the 400 Bad Request. I'm thinking my version 13 of WebSocket will not work with the old WebMFD.dll. I'm playing with subprotocols and binaryType. Suggestions appreciated.
6/18/2012 - It is a version problem. The Websocket button request in the current WebMFD expects an earlier, draft version of Websockets. The new RFC websockets has just sec-websocket-key and not sec-websocket-key1 and sec-websocket-key2. I optimistically attempted to change the code to look for just "key" but of course that causes failures in the response key code. From what I've read, the change to the RFC version of websockets by most browser has caused problems a lot more servers than WebMFD.