diff --git a/README.md b/README.md index 196455562..3a23aed9d 100644 --- a/README.md +++ b/README.md @@ -266,8 +266,10 @@ wss.on('connection', function connection(ws, request, client) { }); server.on('upgrade', function upgrade(request, socket, head) { + // This function is not defined on purpose. Implement it with your own logic. authenticate(request, (err, client) => { if (err || !client) { + socket.write('HTTP/1.1 401 Unauthorized\r\n\r\n'); socket.destroy(); return; }