I am trying to implement WebSocket with php. And on my desktop computer It works correctly. But when I try to open my website on an android device. My server implementation gives the error below while handshaking.
Undefined index: Sec-WebSocket-Key
Then I checked the values. When I connected to web site with my desktop computers browser, Header contains Sec-WebSocket-Key index in header. But when I connected to web site from an android device, Header contains Sec-WebSocket-Key1 and Sec-WebSocket-Key2, but no Sec-WebSocket-Key. Therefore, It throws an exception. Is there any solution for this problem? Do I need two websokcet implementations, one for mobile and one for desktop?
Thanks in advance.
Sec-WebSocket-Key1
and Sec-WebSocket-Key2
are from early experimental drafts of the websocket proposal.
http://tools.ietf.org/html/draft-hixie-thewebsocketprotocol-76#section-8.4
That means your android device (be it the browser or some websocket library) doesn't support the final RFC6455 WebSocket Standard.
To know what version your android device is using ...
Sec-WebSocket-Version
header, if found, that's your version.Sec-WebSocket-Draft
header, if found, that's your draft (non-final) version.Version numbers are registered at the IANA WebSocket Version Number Registry. https://www.iana.org/assignments/websocket/websocket.xml