Server not sending HTTP 101 response when creating a websocket using CC3000 and socket.io -


i connecting cc3000 node.js server using socket.io. have used following library create websocket https://github.com/chadstachowicz/socket_io_arduino_cc3000

in socketioclient.cpp, creates tcp connection, gets session-id(sid). disconnects , creates tcp connection , uses sid upgrade connection websocket. client(here cc3000) sends following header information:

client.print(f("get /socket.io/1/websocket/")); client.print(sid); client.println(f(" http/1.1")); client.print(f("host: ")); client.println(hostname); client.println(f("origin: arduinosocketioclient")); client.println(f("upgrade: websocket"));    // must camelcase ?! client.println(f("connection: upgrade\r\n")); 

after request client waits http 101 response server. server not sending response. logs warning "websocket connection invalid" , ends connection.

is protocol creating websocket fine or there missing information in header?

also, want know should value of 'origin' be? during first handshake "arduino" whereas in second handshake "arduinosocketioclient".

you missing sec-websocket-key , sec-websocket-version headers, key part of websocket protocol handshake.

this how actual handshake looks:

get /chat http/1.1 host: server.example.com upgrade: websocket connection: upgrade sec-websocket-key: x3jjhmbdl1ezlkh9gbhxdw== sec-websocket-protocol: chat, superchat sec-websocket-version: 13 origin: http://example.com 

Comments

Popular posts from this blog

windows - Single EXE to Install Python Standalone Executable for Easy Distribution -

c# - Access objects in UserControl from MainWindow in WPF -

javascript - How to name a jQuery function to make a browser's back button work? -