c++ - nodejs socket.io closes connection before upgrading to websocket -
i'm trying write c++ client talk websocket server written using nodejs , socket.io. can't c++ client establish websocket connection; server drops connection right after client requests http connection upgraded websocket.
i used tcpdump watch packets going , forth. when use websocket server browser, works great , tcpdump output shows packets going , forth. when try connect server using c++ client, websocket connection never gets established. output tcpdump shows upgrade request being sent server followed server dropping connection.
i tried replicating sequence of events using nc
. connected server (running on port 8080) , copy-pasted exact set of headers sent browser, captured tcpdump. duplicate of working headers, connection dropped.
there no output on server end indicating why connection gets dropped.
here headers sent:
get /socket.io/?type=player&eio=3&transport=websocket&sid=7mdclht_8ctsd6f4aaac http/1.1 host: localhost:8080 connection: upgrade pragma: no-cache cache-control: no-cache upgrade: websocket origin: http://localhost:8080 sec-websocket-version: 13 user-agent: mozilla/5.0 accept-encoding: gzip, deflate, sdch accept-language: en-us,en;q=0.8 cookie: io=7mdclht_8ctsd6f4aaac sec-websocket-key: nm7f0tlaggc2s6sauphwaq== sec-websocket-extensions: permessage-deflate;client_max_window_bits x-forwarded-proto: http x-forwarded-port: 80 x-forwarded-for: 127.0.0.1
i'm stumped why socket.io isn't upgrading connection. according documentation i've seen websocket protocol ought work. think can think of socket.io expecting cookie or other magic incantation client talking server.
Comments
Post a Comment