Silver Challenge: How I did it

var ws = new WebSocketServer ({
  port : port,
  verifyClient: function(info, cb) {
    if (info.req.headers.authorization == 'Basic Y2xpZW50OlN3b3JkZmlzaA==') {
      cb(true);
    } else {
      cb(false);
    }
  }
});

Is this the solution contemplated by the book? Or the challenge expected a connection to be established then a ‘password’ string to be evaluated then allow the client to access all the messages already sent and the new messages?

To connect to the ws-server I would use the command: wscat -c ws://client:Swordfish@localhost:3001 that would add an Authorization header to the http request. Y2xpZW50OlN3b3JkZmlzaA== is client:Swordfish base64 encoded.

I understood the challenge so the server should be silent, not showing chat room messages and not accepting newcomer messages until this person (or, here, websockets client) will write the password in the console, “letting” the person “in”. This will be similar entering to speakeasy bar.

The name itself “speakeasy” is to speak password with low voice to not be overheard by police.