a value from another time or place. The promise interface allows us to interact with that value consistently, regardless of whether the value comes from the past or the future, whether that value is near by or far away, or even if the value is demonstrably unavailable.
because we will not need the! // user name in the next event! .then(function (user) {! return getPassword()! // nested because we need both user and! // password next! .then(function (password) {! if (user.passwordHash !== hash(password)) {! throw new Error("Can't authenticate");! }! });! });
= new WebSocketServer({port: 8888});! wss.on("connection", function(ws) {! var local = {! greet: function (message) {! console.log("Greeting:", message);! }! };! Connection(ws, local);! }); server