I'am trying to achieve an open source CometD library in C, to be able to run a CometD client on barely any given device.
The Long_Polling technique to handshake and communicate with the server is done, so logically i have to give the WebSocket option to the user.
So i fetched the Inter Web and bumped into the NoPoll library to help me out on the WebSocket part.
Thanks to NoPoll now i can reach the server and knock on his door, but when i try to handshake with it i always get this 400 Error :
Here is my Handshake :
GET ws://m.zpush.ovh:8080/str/strd HTTP/1.1
Host: m.zpush.ovh:8080
Upgrade: websocket
Connection: Upgrade
Sec-WebSocket-Extension: permessage-deflate;client_max_window_bits
Sec-WebSocket-Key: Z0WLawAAAADGI3syAAAAAA==
Origin: null
Cookie: BAYEUX_BROWSER=56a9-mchhnynonz6ji8a6hs1sh49; JSESSIONID=8gz8e00htqrl15vcm3o9yi95f
Sec-WebSocket-Version: 13
And here is the Jetty error :
WARN:oejh.HttpParser:qtp1213415012-14: badMessage: 400 for HttpChannelOverHttp@40ec53c2{r=0,c=false,a=IDLE,uri=-}
So i fetched again the cybernet but i didn't found any clue about it. From i what i read jetty usually gives more precise error messages, but you will agree this one is very blurry.
It doesn't tell my why and what should i fix to achieve the Handshake. But i suspect that i'am missing something in the HandShake Format.
The other thing that i doesn't understand is that it says "HttpParser" but i'am looking for a WebSocket Handshake.
Any light on this would be much appreciated, and as always when i get an answer i properly make a little tutorial using the given answer to help others developers and give them some code to stand on.
PS : I can upload my code on GitHub if it is needed no problem.
Thank you for your time.
Very likely you have a misconfigured server, without support for WebSocket.
I suggest that you start the CometD demo server like explained here, and try your C client against that.
I just tried your upgrade request (just replaced the host name and port), and it works just fine.