5

I try to run a websocket application (php-based chat) and need to get the Sec-WebSocket-Key out of the Handshake header I get by executing:

$socket_new = socket_accept($socket); $header = socket_read($socket_new, 5000);

But the needed Attribute is missing in my header... here you can see the print of the revieved header. The WebSocket client normally should set this param itself?!

GET / HTTP/1.1
Host: X.XXX.XXX.XXX:9000
Connection: keep-alive
Cache-Control: max-age=0
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.99 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
DNT: 1
Accept-Encoding: gzip, deflate, sdch
Accept-Language: de-DE,de;q=0.8,en-US;q=0.6,en;q=0.4
Cookie: csrftoken=ZiNFgXXXXNYSoi0XkCtiudR00aHwm; sessionid=7s2pdmfvchwylXXXXtqv0rzbn7bd

I tried it with Firefox and Chrome and my Server runs on an Debian server. Do I need to install something on my server (like any WebSocket lib) ?

Or why are the Sec-WebSocket Attributes missing?

zypro
  • 1,158
  • 3
  • 12
  • 33

0 Answers0