packages-http
packages-http copied to clipboard
WebSocket handshake fails in Chrome due to missing Sec-WebSocket-Protocol field
Steps to reproduce:
-
Start the echo server that is shown in the documentation of
library(http/websocket), using:?- http_server(http_dispatch, [port(8090)]). -
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!