packages-http icon indicating copy to clipboard operation
packages-http copied to clipboard

WebSocket handshake fails in Chrome due to missing Sec-WebSocket-Protocol field

Open triska opened this issue 9 years ago • 0 comments

Steps to reproduce:

  1. Start the echo server that is shown in the documentation of library(http/websocket), using:

    ?- http_server(http_dispatch, [port(8090)]).
    
  2. Use the following JavaScript line to establish a WebSocket connection in Chrome:

    var s = new WebSocket("ws://localhost:8090/ws", "protocolOne");
    

Chrome refuses the connection with:

Error during WebSocket handshake: Sent non-empty 'Sec-WebSocket-Protocol' header but no response was received

If possible, please add this header field to the response. Thank you!

triska avatar Sep 12 '16 21:09 triska