Ive tried several approaches and even copy/pasted from http://code.google.com/p/phpwebsocket/
Im using Google Chrome 5.0.375.70 beta and the error is always the s开发者_如何学Goame: Error: INVALID_STATE_ERR: DOM Exception 11
when debugging I see the readyState is always 0 (connecting), no other error is shown.
Any ideas?
There are currently 2 supported Drafts of the WebSocket API in the wild.
Draft75 which is the one that is supported by the linked PHP script, and Draft76 which requires a different Upgrade Header and Handshake, another one Draft77 is also finished and may suddenly and up being implement by a Browser.
Somewhere between Version 5 and 6 of Chrome they did the switch from Draft75 to Draft76.
As far as I can see here, the PHP Script does not terminate the connection when it receives an invalid upgrade header. Therefore Chrome will still wait for the Handshake, which explains while the ReadyState does not change.
精彩评论