This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 17644 - OK I spent hours all over the web and your docs getting to grips with websocket, my question now is this.... in the the handshake....how does one actually implement the header for the websocket? there is not explanation of this anywhere... how is the head
Summary: OK I spent hours all over the web and your docs getting to grips with websock...
Status: RESOLVED INVALID
Alias: None
Product: WebAppsWG
Classification: Unclassified
Component: WebSocket API (editor: Ian Hickson) (show other bugs)
Version: unspecified
Hardware: Other other
: P3 normal
Target Milestone: ---
Assignee: Ian 'Hixie' Hickson
QA Contact: public-webapps-bugzilla
URL: http://www.whatwg.org/specs/web-apps/...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-06-28 23:46 UTC by contributor
Modified: 2012-06-29 08:04 UTC (History)
3 users (show)

See Also:


Attachments

Description contributor 2012-06-28 23:46:58 UTC
Specification: http://www.w3.org/TR/websockets/
Multipage: http://www.whatwg.org/C#top
Complete: http://www.whatwg.org/c#top

Comment:
OK I spent hours all over the web and your docs getting to grips with
websocket, my question now is this....
in the the handshake....how does one actually implement the header for the
websocket? there is not explanation of this anywhere...

how is the header constructed in either php or javascript for the websocket
handshake for the example like:

GET /chat HTTP/1.1
	Host: server.example.com
	Upgrade: websocket
	Connection: Upgrade
	Sec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ==
	Origin: http://example.com
	Sec-WebSocket-Protocol: chat, superchat
	Sec-WebSocket-Version: 13

Because during my test...I in chrome I see the error:
Error during WebSocket handshake: 'Sec-WebSocket-Accept' header is missing

in the server it keeps disconnecting...I am testing locally in xampp...and and
enabled the websocket that works with like: 
php -q C:\xampp\htdocs\server\server.php

but it disconnects and the chrome console shows:
Error during WebSocket handshake: 'Sec-WebSocket-Accept' header is missing


Can I see an example of how to actually send the headers and the
Sec-WebSocket-Key in when we send the handshake?

Posted from: 87.114.223.140
User agent: Mozilla/5.0 (Windows NT 6.0) AppleWebKit/536.5 (KHTML, like Gecko) Chrome/19.0.1084.56 Safari/536.5
Comment 1 Olli Pettay 2012-06-29 08:04:18 UTC
Protocol is defined in the IETF spec.