Вопрос

I'm making a C server of websocket :D actually one time I did connect successfully but after then, this onOpen is not triggering again...and tells me

Error during WebSocket handshake: Sec-WebSocket-Accept mismatch

so now I need to check what client HTML takes especially the Sec-WebSocket-Accept field

Is there a way I can check Sec-WebSocket-Accept field in javascript client side? What value should I check for this?

Это было полезно?

Решение

The Sec-WebSocket-Accept header expected to be sent by a WebSocket server during the initial opening handshake cannot be accessed from JavaScript (in browsers).

You can however look at the complete opening handshake i.e. in the developer console of Chrome, after the handshake has succeeded.

The value must be computed by the server based on the Sec-WebSocket-Key sent by the client (and a magic string). You can read the details in http://tools.ietf.org/html/rfc6455

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top