I only support websockets protocol version 13.

git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@3215 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
Cory McWilliams 2016-04-23 18:17:55 +00:00
parent ca1271ffbc
commit b265d65e11

View File

@ -285,11 +285,15 @@ function handleWebSocketRequest(request, response, client) {
logError(client.peerName + " - - [" + new Date() + "] " + error); logError(client.peerName + " - - [" + new Date() + "] " + error);
}); });
response.writeHead(101, { let headers = {
"Upgrade": "websocket", "Upgrade": "websocket",
"Connection": "Upgrade", "Connection": "Upgrade",
"Sec-WebSocket-Accept": webSocketAcceptResponse(request.headers["sec-websocket-key"]), "Sec-WebSocket-Accept": webSocketAcceptResponse(request.headers["sec-websocket-key"]),
}); };
if (request.headers["sec-websocket-version"] != "13") {
headers["Sec-WebSocket-Version"] = "13";
}
response.writeHead(101, headers);
} }
function webSocketAcceptResponse(key) { function webSocketAcceptResponse(key) {