So, I saw this wonderful blog post, Experimenting with Node.js. I decided to try and configure it myself using the author gist . This did not work.
Further debugging shows me that the websocket plugs in normally, but closes as soon as send is called. Here is the wire route (sorry for the weird distance):
GET /test HTTP/1.1 Host: 127.0.0.1:8000 Sec-WebSocket-Key2: 3 j 92 9 62" 7 0 8 8 Upgrade: WebSocket Connection: Upgrade Origin: http://127.0.0.1:3000 Sec-WebSocket-Key1: 96'5% S72.93?06 ......(bHTTP/1.1 101 WebSocket Protocol Handshake Upgrade: WebSocket Connection: Upgrade Sec-WebSocket-Origin: http://127.0.0.1:3000 Sec-WebSocket-Location: ws://127.0.0.1:8000/test .4.R....mh.....{.{"action":"move","x":450,"y":22,"w":1146,"h":551}.
I tried this in both the beta version of Chrome and Firefox 4.0. Both of them exhibit the same behavior. If I go to the original blog site , it works great.
Another thing. If I log into the JS console in either FF or Chrome, and do the following:
ws = new WebSocket('ws://localhost:8000/test') ws.send("foo")
It immediately disconnects and does not send a message. The server shows a connection and a handshake, but never receives a message.
I found several questions that were similar, but were resolved without posting the fix or did not seem to apply in this situation. I can post the code from gist if this simplifies.
hernan43
source share